public static byte[] readData(DataInput in) throws IOException { return readData(in, DEFAULT_MAX_LEN); }
public Integer readNullableInt() throws IOException { if (readBoolean()) { return readInt(); } else { return null; } }
public <X> X readEnum(Class<X> enumClass) throws IOException { return readEnum(enumClass, (int) readUnsignedNumber()); }
public Double readNullableDouble() throws IOException { if (readBoolean()) { return readDouble(); } else { return null; } }
public Float readNullableFloat() throws IOException { if (readBoolean()) { return readFloat(); } else { return null; } }
public Short readNullableShort() throws IOException { if (readBoolean()) { return readShort(); } else { return null; } }
public void deserialize(DataInputStream is) throws IOException { final long len = is.readUnsignedNumber(); new ArrayList<byte[]>((int) len); for (int i = 0; i < len; i++) { dataList.add(is.readData()); } }
public Long readNullableLong() throws IOException { if (readBoolean()) { return readLong(); } else { return null; } }
public Byte readNullableByte() throws IOException { if (readBoolean()) { return readByte(); } else { return null; } }
/** * Create a new byte array of specified size, and read data using {@link java.io.DataInput#readFully(byte[])} * * @param dataLen new buffer size * @return data read * @throws IOException If an error occured reading the data */ public byte[] readFully(int dataLen) throws IOException { return readFully(this, dataLen); }
public Boolean readNullableBoolean() throws IOException { if (readBoolean()) { return readBoolean(); } else { return null; } }
public long readUnsignedNumber() throws IOException { long number = 0; int shift = 0; boolean more; do { int i = read(); if (i == -1) { break; } more = (i & 128L) > 0; number = number | ((i & 127L) << shift); shift += 7; } while (more); return number; }
public Double readNullableDouble() throws IOException { if (readBoolean()) { return readDouble(); } else { return null; } }
public Float readNullableFloat() throws IOException { if (readBoolean()) { return readFloat(); } else { return null; } }
public Short readNullableShort() throws IOException { if (readBoolean()) { return readShort(); } else { return null; } }