}
private Decoder readBody(Message message)
{
BytesMessage msg = (BytesMessage) message;
BBDecoder dec = new BBDecoder();
byte[] buf = new byte[1024];
byte[] body = new byte[1024];
int size = 0;
int n;
try
{
while ((n = msg.readBytes(buf)) > 0)
{
body = ensure(size + n, body, size);
System.arraycopy(buf, 0, body, size, n);
size += n;
}
} catch (JMSException e)
{
throw new AgentException(e);
}
dec.init(ByteBuffer.wrap(body, 0, size));
return dec;
}