MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / deserializeObject

Method deserializeObject

src/RegionClient.java:1839–1865  ·  view source on GitHub ↗

De-serializes a "Writable" serialized by HbaseObjectWritable#writeObject. @return The de-serialized object (which can be null).

(final ChannelBuffer buf,
                                  final HBaseRpc request)

Source from the content-addressed store, hash-verified

1837 * @return The de-serialized object (which can be {@code null}).
1838 */
1839 @SuppressWarnings("fallthrough")
1840 static Object deserializeObject(final ChannelBuffer buf,
1841 final HBaseRpc request) {
1842 switch (buf.readByte()) { // Read the type of the response.
1843 case 1: // Boolean
1844 return buf.readByte() != 0x00;
1845 case 6: // Long
1846 return buf.readLong();
1847 case 14: // Writable
1848 return deserializeObject(buf, request); // Recursively de-serialize it.
1849 case 17: // NullInstance
1850 buf.readByte(); // Consume the (useless) type of the "null".
1851 return null;
1852 case 37: // Result
1853 buf.readByte(); // Read the type again. See HBASE-2877.
1854 return parseResult(buf);
1855 case 38: // Result[]
1856 return parseResults(buf);
1857 case 58: // MultiPutResponse
1858 // Fall through
1859 case 67: // MultiResponse
1860 // Don't read the type again, responseFromBuffer() will need it.
1861 return ((MultiAction) request).responseFromBuffer(buf);
1862 }
1863 throw new NonRecoverableException("Couldn't de-serialize "
1864 + Bytes.pretty(buf));
1865 }
1866
1867 /**
1868 * Pre-computes how many KVs we have so we can rightsized arrays.

Callers 3

deserializeMethod · 0.95
decodeMultiResponseMethod · 0.95

Calls 4

parseResultMethod · 0.95
parseResultsMethod · 0.95
prettyMethod · 0.95
responseFromBufferMethod · 0.80

Tested by

no test coverage detected