public ArrayWritable readArray(ArrayWritable aw) throws IOException { if (aw == null) { aw = new ArrayWritable(TypedBytesWritable.class); } else if (!aw.getValueClass().equals(TypedBytesWritable.class)) { throw new RuntimeException("value class has to be TypedBytesWritable"); } int length = in.readVectorHeader(); Writable[] writables = new Writable[length]; for (int i = 0; i < length; i++) { writables[i] = new TypedBytesWritable(in.readRaw()); } aw.set(writables); return aw; }
/** * Reads the raw bytes following a <code>Type.LIST</code> code. * * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawList() throws IOException { Buffer buffer = new Buffer(new byte[] {(byte) Type.LIST.code}); byte[] bytes = readRaw(); while (bytes != null) { buffer.append(bytes); bytes = readRaw(); } buffer.append(new byte[] {(byte) Type.MARKER.code}); return buffer.get(); }
/** * Reads the raw bytes following a <code>Type.LIST</code> code. * * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawList() throws IOException { Buffer buffer = new Buffer(new byte[] {(byte) Type.LIST.code}); byte[] bytes = readRaw(); while (bytes != null) { buffer.append(bytes); bytes = readRaw(); } buffer.append(new byte[] {(byte) Type.MARKER.code}); return buffer.get(); }
public ArrayWritable readArray(ArrayWritable aw) throws IOException { if (aw == null) { aw = new ArrayWritable(TypedBytesWritable.class); } else if (!aw.getValueClass().equals(TypedBytesWritable.class)) { throw new RuntimeException("value class has to be TypedBytesWritable"); } int length = in.readVectorHeader(); Writable[] writables = new Writable[length]; for (int i = 0; i < length; i++) { writables[i] = new TypedBytesWritable(in.readRaw()); } aw.set(writables); return aw; }
public ArrayWritable readArray(ArrayWritable aw) throws IOException { if (aw == null) { aw = new ArrayWritable(TypedBytesWritable.class); } else if (!aw.getValueClass().equals(TypedBytesWritable.class)) { throw new RuntimeException("value class has to be TypedBytesWritable"); } int length = in.readVectorHeader(); Writable[] writables = new Writable[length]; for (int i = 0; i < length; i++) { writables[i] = new TypedBytesWritable(in.readRaw()); } aw.set(writables); return aw; }
public ArrayWritable readArray(ArrayWritable aw) throws IOException { if (aw == null) { aw = new ArrayWritable(TypedBytesWritable.class); } else if (!aw.getValueClass().equals(TypedBytesWritable.class)) { throw new RuntimeException("value class has to be TypedBytesWritable"); } int length = in.readVectorHeader(); Writable[] writables = new Writable[length]; for (int i = 0; i < length; i++) { writables[i] = new TypedBytesWritable(in.readRaw()); } aw.set(writables); return aw; }
public ArrayWritable readArray(ArrayWritable aw) throws IOException { if (aw == null) { aw = new ArrayWritable(TypedBytesWritable.class); } else if (!aw.getValueClass().equals(TypedBytesWritable.class)) { throw new RuntimeException("value class has to be TypedBytesWritable"); } int length = in.readVectorHeader(); Writable[] writables = new Writable[length]; for (int i = 0; i < length; i++) { writables[i] = new TypedBytesWritable(in.readRaw()); } aw.set(writables); return aw; }
/** * Reads the raw bytes following a <code>Type.MAP</code> code. * * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawMap() throws IOException { Buffer buffer = new Buffer(); int length = readMapHeader(); buffer.append(new byte[] {(byte) Type.MAP.code, (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)), (byte) (0xff & (length >> 8)), (byte) (0xff & length)}); for (int i = 0; i < length; i++) { buffer.append(readRaw()); buffer.append(readRaw()); } return buffer.get(); }
/** * Reads the raw bytes following a <code>Type.MAP</code> code. * * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawMap() throws IOException { Buffer buffer = new Buffer(); int length = readMapHeader(); buffer.append(new byte[] {(byte) Type.MAP.code, (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)), (byte) (0xff & (length >> 8)), (byte) (0xff & length)}); for (int i = 0; i < length; i++) { buffer.append(readRaw()); buffer.append(readRaw()); } return buffer.get(); }
/** * Reads the raw bytes following a <code>Type.VECTOR</code> code. * * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawVector() throws IOException { Buffer buffer = new Buffer(); int length = readVectorHeader(); buffer.append(new byte[] {(byte) Type.VECTOR.code, (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)), (byte) (0xff & (length >> 8)), (byte) (0xff & length)}); for (int i = 0; i < length; i++) { buffer.append(readRaw()); } return buffer.get(); }
/** * Reads the raw bytes following a <code>Type.VECTOR</code> code. * * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawVector() throws IOException { Buffer buffer = new Buffer(); int length = readVectorHeader(); buffer.append(new byte[] {(byte) Type.VECTOR.code, (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)), (byte) (0xff & (length >> 8)), (byte) (0xff & length)}); for (int i = 0; i < length; i++) { buffer.append(readRaw()); } return buffer.get(); }