Archived

This forum has been archived. Please start a new discussion on GitHub.

Ice 3.2.1: Java stream helper functions

kwaclaw
kwaclaw Oshawa, Canada
I compiled some slice IDL with slice2java using the --stream option.
The resulting code does not compile. It might be my fault, but I don't know how to solve it.

The IDL in question is:
struct Prop {
    int Index;
    Ice::ByteSeq Value;
  };

The last two methods in the generated code below do not compile, as it seems their parameter (of type InputStream or OutputStream) does not match the parameter type needed to pass to ByteSeqHelper.read/write:
(I have marked the problem spots with a comment)

public final class Prop implements java.lang.Cloneable
{
    public int Index;

    public byte[] Value;

    . . . 

    public void
    __write(IceInternal.BasicStream __os)
    {
        __os.writeInt(Index);
        Ice.ByteSeqHelper.write(__os, Value);
    }

    public void
    __read(IceInternal.BasicStream __is)
    {
        Index = __is.readInt();
        Value = Ice.ByteSeqHelper.read(__is);
    }

    public void
    ice_write(Ice.OutputStream __outS)
    {
        __outS.writeInt(Index);
        Ice.ByteSeqHelper.write(__outS, Value);  // issue here
    }

    public void
    ice_read(Ice.InputStream __inS)
    {
        Index = __inS.readInt();
        Value = Ice.ByteSeqHelper.read(__inS);  // issue here
    }


Karl

Comments

  • Thanks for the bug report Karl, I'll have a look at this.

    Cheers,

    Michi.
  • Hi Karl,

    the problem arises because BuiltinSequences.ice is not compiled with the --stream option. As a result, the generated Helper class does not have the method to marshal the stream, and you get the compilation error.

    One way to solve this is to recompile BuiltinSequences.ice with --stream and to rebuild the Ice.jar file.

    Another way would be to not use Ice::ByteSeq and instead define your own byte sequence type, which you compile with --stream.

    Cheers,

    Michi.
  • kwaclaw
    kwaclaw Oshawa, Canada
    michi wrote: »
    Hi Karl,

    the problem arises because BuiltinSequences.ice is not compiled with the --stream option. As a result, the generated Helper class does not have the method to marshal the stream, and you get the compilation error.

    One way to solve this is to recompile BuiltinSequences.ice with --stream and to rebuild the Ice.jar file.

    Another way would be to not use Ice::ByteSeq and instead define your own byte sequence type, which you compile with --stream.

    Cheers,

    Michi.

    I understand. I am using only a few built-in Slice types, so it's not much
    work to throw them out.

    Thanks,

    Karl