On Fri, 2013-02-15 at 16:00 -0500, Alan Conway wrote:
> On Fri, 2013-02-15 at 17:03 +0100, Rob Godfrey wrote:
> > Hi Alan,
> > 
> > you can use the java Encoder/Decoders directly like this:
> > 
> > import org.apache.qpid.proton.codec.EncoderImpl;
> > import org.apache.qpid.proton.codec.DeccoderImpl;
> > 
> > ...
> > 
> > 
> >         ByteBuffer buf = ByteBuffer.allocate(2048);
> > 
> >         DecoderImpl decoder = new DecoderImpl();
> >         EncoderImpl encoder = new EncoderImpl(buf, decoder);
> > 
> >         // write an array of 12 (false) booleans
> >         boolean[] o = new boolean[12];
> >         encoder.writeObject(o);
> > 
> >         // buf will now contain the encoded data, call flip() to move
> > position to 0,
> >         // limit end of encoded data
> >         buf.flip();
> > 
> > 
> >         // now read the encoded bytes
> > 
> >         decoder.setByteBuffer(buf);
> > 
> >         Object read = decoder.readObject();
> 
> Having some trouble with this, I get a
> org.apache.qpid.proton.codec.DecodeException: Unknown constructor
> 
> The value it is objecting to is decimal 65, 0x41, which is the
> constructor code for boolean true.
> 
> Do I have to do something with DecoderImpl.register in order for its
> _constructors map to be populated?
> 
> 
> 
Never mind, found it: AmqpDefinedTypes.registerAllTypes

Reply via email to