List of usage examples for org.apache.hadoop.typedbytes TypedBytesInput readMap
@SuppressWarnings("unchecked") public TreeMap readMap() throws IOException
Type.MAP
code. From source file:fm.last.pigtail.storage.TypedBytesSequenceFileLoader.java
License:Apache License
@Override public Map<String, Object> bytesToMap(byte[] b) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(b); DataInputStream dis = new DataInputStream(bais); TypedBytesInput tbin = TypedBytesInput.get(dis); if (tbin.readType() != org.apache.hadoop.typedbytes.Type.MAP) { throw new FrontendException("Type code does not correspond to map."); }//from w w w . jav a 2 s .c om Map<String, Object> result = new HashMap<String, Object>(); for (Object item : tbin.readMap().entrySet()) { Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) item; result.put(entry.getKey().toString(), entry.getValue()); } return result; }