List of usage examples for org.apache.hadoop.record Buffer append
public void append(byte[] bytes)
From source file:com.jfolson.hive.serde.RTypedBytesInput.java
License:Apache License
/** * Reads the raw bytes following a <code>Type.VECTOR</code> code. * //www . j a va 2s . c om * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawVector() throws IOException { Buffer buffer = new Buffer(); int length = readVectorHeader(); buffer.append(new byte[] { (byte) RType.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(); }
From source file:com.jfolson.hive.serde.RTypedBytesInput.java
License:Apache License
/** * Reads the raw bytes following a <code>Type.LIST</code> code. * //from www. jav a 2 s . co m * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawList() throws IOException { Buffer buffer = new Buffer(new byte[] { (byte) RType.LIST.code }); byte[] bytes = readRaw(); while (bytes != null) { buffer.append(bytes); bytes = readRaw(); } buffer.append(new byte[] { (byte) RType.MARKER.code }); return buffer.get(); }
From source file:com.jfolson.hive.serde.RTypedBytesInput.java
License:Apache License
/** * Reads the raw bytes following a <code>Type.MAP</code> code. * //from www . j a v a 2s.c o m * @return the obtained bytes sequence * @throws IOException */ public byte[] readRawMap() throws IOException { Buffer buffer = new Buffer(); int length = readMapHeader(); buffer.append(new byte[] { (byte) RType.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(); }