@Test public void testUnmarshallByteArray() { ByteArrayOutputStream colSpec = new ByteArrayOutputStream(); colSpec.write(BYTE_ARRAY); colSpec.write('D'); byte[] c = colSpec.toByteArray(); byte[] input = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05}, expected = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05}; assertArrayEquals(expected, (byte[])unmarshall(c, input)); }
@SuppressWarnings("fallthrough") public static Object unmarshall(byte[] colSpec, byte[] colVal) { byte type = colSpec[0]; switch (type) { case LONG: return Bytes.toLong(colVal); case STRING: return Bytes.toString(colVal); case DATE: return new Date(Bytes.toLong(colVal)); case JSON: try { return mapper.readValue(colVal, 0, colVal.length, Object.class); } catch (IOException e) { } case BYTE_ARRAY: return colVal; case BUFFER_STREAM: return new BufferProxy(colVal); case FILE_STREAM: return new FileProxy(Bytes.toString(colVal)); } return null; }
FsEntryHBaseCommon { @SuppressWarnings("fallthrough") public static Object unmarshall(byte[] colSpec, byte[] colVal) { byte type = colSpec[0]; switch (type) { case LONG: return Bytes.toLong(colVal); case STRING: return Bytes.toString(colVal); case DATE: return new Date(Bytes.toLong(colVal)); case JSON: try { return mapper.readValue(colVal, 0, colVal.length, Object.class); } catch (IOException e) { } case BYTE_ARRAY: return colVal; case BUFFER_STREAM: return new BufferProxy(colVal); case FILE_STREAM: return new FileProxy(Bytes.toString(colVal)); } return null; } }
FsEntryHBaseCommon { @SuppressWarnings("fallthrough") public static Object unmarshall(byte[] colSpec, byte[] colVal) { byte type = colSpec[0]; switch (type) { case LONG: return Bytes.toLong(colVal); case STRING: return Bytes.toString(colVal); case DATE: return new Date(Bytes.toLong(colVal)); case JSON: try { return mapper.readValue(colVal, 0, colVal.length, Object.class); } catch (IOException e) { } case BYTE_ARRAY: return colVal; case BUFFER_STREAM: return new BufferProxy(colVal); case FILE_STREAM: return new FileProxy(Bytes.toString(colVal)); } return null; }  }
FsEntryHBaseCommon { @SuppressWarnings("fallthrough") public static Object unmarshall(byte[] colSpec, byte[] colVal) { byte type = colSpec[0]; switch (type) { case LONG: return Bytes.toLong(colVal); case STRING: return Bytes.toString(colVal); case DATE: return new Date(Bytes.toLong(colVal)); case JSON: try { return mapper.readValue(colVal, 0, colVal.length, Object.class); } catch (IOException e) { } case BYTE_ARRAY: return colVal; case BUFFER_STREAM: return new BufferProxy(colVal); case FILE_STREAM: return new FileProxy(Bytes.toString(colVal)); } return null; }  static byte typeVal(Object o); static byte[] createColSpec(Object o, String colName); static byte[] createColSpec(byte type, String colName); static String colName(byte[] colSpec); @SuppressWarnings("fallthrough") static Object unmarshall(byte[] colSpec, byte[] colVal); static void populate(Map<byte[], byte[]> input, Map<String,Object> out, Map<String, StreamProxy> streams); }
FsEntryHBaseCommon { @SuppressWarnings("fallthrough") public static Object unmarshall(byte[] colSpec, byte[] colVal) { byte type = colSpec[0]; switch (type) { case LONG: return Bytes.toLong(colVal); case STRING: return Bytes.toString(colVal); case DATE: return new Date(Bytes.toLong(colVal)); case JSON: try { return mapper.readValue(colVal, 0, colVal.length, Object.class); } catch (IOException e) { } case BYTE_ARRAY: return colVal; case BUFFER_STREAM: return new BufferProxy(colVal); case FILE_STREAM: return new FileProxy(Bytes.toString(colVal)); } return null; }  static byte typeVal(Object o); static byte[] createColSpec(Object o, String colName); static byte[] createColSpec(byte type, String colName); static String colName(byte[] colSpec); @SuppressWarnings("fallthrough") static Object unmarshall(byte[] colSpec, byte[] colVal); static void populate(Map<byte[], byte[]> input, Map<String,Object> out, Map<String, StreamProxy> streams); static final byte LONG; static final byte STRING; static final byte DATE; static final byte JSON; static final byte BYTE_ARRAY; static final byte BUFFER_STREAM; static final byte FILE_STREAM; }