@Test public void testClose() throws Exception { BinaryData binaryData = new BinaryData(buildByteArray("123"), buildInputStream("")); Assert.assertEquals(3, binaryData.available()); Assert.assertEquals('1', binaryData.read()); Assert.assertEquals(2, binaryData.available()); binaryData.close(); Assert.assertEquals(0, binaryData.available()); Assert.assertEquals(-1, binaryData.read()); }
public void close() throws IOException { inMemoryData = new byte[0]; inMemoryDataPointer = 0; streamData.close(); if (onCloseAction != null) { onCloseAction.run(); } }
BinaryData extends InputStream { public void close() throws IOException { inMemoryData = new byte[0]; inMemoryDataPointer = 0; streamData.close(); if (onCloseAction != null) { onCloseAction.run(); } } }
BinaryData extends InputStream { public void close() throws IOException { inMemoryData = new byte[0]; inMemoryDataPointer = 0; streamData.close(); if (onCloseAction != null) { onCloseAction.run(); } } BinaryData(byte[] inMemoryData, InputStream streamData); }
BinaryData extends InputStream { public void close() throws IOException { inMemoryData = new byte[0]; inMemoryDataPointer = 0; streamData.close(); if (onCloseAction != null) { onCloseAction.run(); } } BinaryData(byte[] inMemoryData, InputStream streamData); void setOnCloseAction(Runnable action); int read(); int read(byte[] b); int read(byte[] b, int off, int len); long skip(long n); int available(); void close(); void mark(int readlimit); void reset(); boolean markSupported(); }
BinaryData extends InputStream { public void close() throws IOException { inMemoryData = new byte[0]; inMemoryDataPointer = 0; streamData.close(); if (onCloseAction != null) { onCloseAction.run(); } } BinaryData(byte[] inMemoryData, InputStream streamData); void setOnCloseAction(Runnable action); int read(); int read(byte[] b); int read(byte[] b, int off, int len); long skip(long n); int available(); void close(); void mark(int readlimit); void reset(); boolean markSupported();  }