@Test public void testEmptyByteArrayForEmptyInput() throws IOException { this.fstObjectInput = new FstObjectInput(new ByteArrayInputStream("".getBytes())); byte[] bytes = fstObjectInput.readBytes(); assertThat(bytes.length, is(0)); }
@Override public byte[] readBytes() throws IOException { int len = input.readInt(); if (len < 0) { return null; } else if (len == 0) { return new byte[]{}; } else { byte[] b = new byte[len]; input.readFully(b); return b; } }
FstObjectInput implements ObjectInput { @Override public byte[] readBytes() throws IOException { int len = input.readInt(); if (len < 0) { return null; } else if (len == 0) { return new byte[]{}; } else { byte[] b = new byte[len]; input.readFully(b); return b; } } }
FstObjectInput implements ObjectInput { @Override public byte[] readBytes() throws IOException { int len = input.readInt(); if (len < 0) { return null; } else if (len == 0) { return new byte[]{}; } else { byte[] b = new byte[len]; input.readFully(b); return b; } } FstObjectInput(InputStream inputStream); }
FstObjectInput implements ObjectInput { @Override public byte[] readBytes() throws IOException { int len = input.readInt(); if (len < 0) { return null; } else if (len == 0) { return new byte[]{}; } else { byte[] b = new byte[len]; input.readFully(b); return b; } } FstObjectInput(InputStream inputStream); @Override boolean readBool(); @Override byte readByte(); @Override short readShort(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override byte[] readBytes(); @Override String readUTF(); @Override Object readObject(); @Override @SuppressWarnings("unchecked") T readObject(Class<T> clazz); @Override @SuppressWarnings("unchecked") T readObject(Class<T> clazz, Type type); }
FstObjectInput implements ObjectInput { @Override public byte[] readBytes() throws IOException { int len = input.readInt(); if (len < 0) { return null; } else if (len == 0) { return new byte[]{}; } else { byte[] b = new byte[len]; input.readFully(b); return b; } } FstObjectInput(InputStream inputStream); @Override boolean readBool(); @Override byte readByte(); @Override short readShort(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override byte[] readBytes(); @Override String readUTF(); @Override Object readObject(); @Override @SuppressWarnings("unchecked") T readObject(Class<T> clazz); @Override @SuppressWarnings("unchecked") T readObject(Class<T> clazz, Type type);  }