@Test public void write() throws Exception { OutputStream os = new UsbFileOutputStream(file); os.write(new byte[20]); verify(file).write(longCaptor.capture(), byteBufferCaptor.capture()); assertEquals(0, longCaptor.getValue().longValue()); assertEquals(20, byteBufferCaptor.getValue().remaining()); os.write(new byte[20]); verify(file, times(2)).write(longCaptor.capture(), byteBufferCaptor.capture()); assertEquals(20, longCaptor.getValue().longValue()); assertEquals(20, byteBufferCaptor.getValue().remaining()); }
@Override public void write(int oneByte) throws IOException { ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {(byte) oneByte}); file.write(currentByteOffset, byteBuffer); currentByteOffset++; }
UsbFileOutputStream extends OutputStream { @Override public void write(int oneByte) throws IOException { ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {(byte) oneByte}); file.write(currentByteOffset, byteBuffer); currentByteOffset++; } }
UsbFileOutputStream extends OutputStream { @Override public void write(int oneByte) throws IOException { ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {(byte) oneByte}); file.write(currentByteOffset, byteBuffer); currentByteOffset++; } UsbFileOutputStream(@NonNull UsbFile file); }
UsbFileOutputStream extends OutputStream { @Override public void write(int oneByte) throws IOException { ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {(byte) oneByte}); file.write(currentByteOffset, byteBuffer); currentByteOffset++; } UsbFileOutputStream(@NonNull UsbFile file); @Override void write(int oneByte); @Override void close(); @Override void flush(); @Override void write(byte[] buffer); @Override void write(byte[] buffer, int offset, int count); }
UsbFileOutputStream extends OutputStream { @Override public void write(int oneByte) throws IOException { ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {(byte) oneByte}); file.write(currentByteOffset, byteBuffer); currentByteOffset++; } UsbFileOutputStream(@NonNull UsbFile file); @Override void write(int oneByte); @Override void close(); @Override void flush(); @Override void write(byte[] buffer); @Override void write(byte[] buffer, int offset, int count);  }