{
bytes[i] = getSamplebyte(i);
}
HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(bytes);
HornetQBufferInputStream is = new HornetQBufferInputStream(buffer);
// First read byte per byte
for (int i = 0 ; i < 1024; i++)
{
assertEquals(getSamplebyte(i), is.read());
}
// Second, read in chunks
for (int i = 1; i < 10; i++)
{
bytes = new byte[1024];
is.read(bytes);
for (int j = 0 ; j < bytes.length; j++)
{
assertEquals(getSamplebyte(i * 1024 + j), bytes[j]);
}
}
assertEquals(-1, is.read());
bytes = new byte[1024];
int sizeRead = is.read(bytes);
assertEquals(-1, sizeRead);
}