FstObjectOutput implements ObjectOutput { @Override public void writeBytes(byte[] v) throws IOException { if (v == null) { output.writeInt(-1); } else { writeBytes(v, 0, v.length); } } FstObjectOutput(OutputStream outputStream); @Override void writeBool(boolean v); @Override void writeByte(byte v); @Override void writeShort(short v); @Override void writeInt(int v); @Override void writeLong(long v); @Override void writeFloat(float v); @Override void writeDouble(double v); @Override void writeBytes(byte[] v); @Override void writeBytes(byte[] v, int off, int len); @Override void writeUTF(String v); @Override void writeObject(Object v); @Override void flushBuffer();  }
@Test public void testWriteBytesWithSubLength() throws IOException { this.fstObjectOutput.writeBytes("who are you".getBytes(), 4, 3); this.flushToInput(); byte[] result = this.fstObjectInput.readBytes(); assertThat(result, is("are".getBytes())); }
@Test public void testWriteBytes() throws IOException { this.fstObjectOutput.writeBytes("who are you".getBytes()); this.flushToInput(); byte[] result = this.fstObjectInput.readBytes(); assertThat(result, is("who are you".getBytes())); }
@Test public void testWriteNullBytesWithSubLength() throws IOException { this.fstObjectOutput.writeBytes(null, 4, 3); this.flushToInput(); byte[] result = this.fstObjectInput.readBytes(); assertThat(result, is(nullValue())); }
@Test public void testWriteNullBytes() throws IOException { this.fstObjectOutput.writeBytes(null); this.flushToInput(); byte[] result = this.fstObjectInput.readBytes(); assertThat(result, is(nullValue())); }