@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Override public int read(final byte[] byteArray) throws IOException { if (bb == null) { throw new IOException("read on a closed InputStream"); } return read(byteArray, 0, byteArray.length); }
@Test public void testReadBytesOnStreaming() throws Exception { byte[] byteArray = new byte[1024]; for (int i = 0; i < byteArray.length; i++) { byteArray[i] = getSamplebyte(i); } ActiveMQBuffer splitbuffer = splitBuffer(3, byteArray); ActiveMQBufferInputStream is = new ActiveMQBufferInputStream(splitbuffer); for (int i = 0; i < 100; i++) { assertEquals(getSamplebyte(i), (byte) is.read()); } for (int i = 100; i < byteArray.length; i += 10) { byte[] readBytes = new byte[10]; int size = is.read(readBytes); for (int j = 0; j < size; j++) { assertEquals(getSamplebyte(i + j), readBytes[j]); } } is.close(); }