Reads a string encoded by hadoop.io.WritableUtils#readString. @throws IllegalArgumentException if the length we read for the string is out of reasonable bounds.
(final ChannelBuffer buf)
| 1103 | * is out of reasonable bounds. |
| 1104 | */ |
| 1105 | static String readHadoopString(final ChannelBuffer buf) { |
| 1106 | final int length = buf.readInt(); |
| 1107 | checkArrayLength(buf, length); |
| 1108 | final byte[] s = new byte[length]; |
| 1109 | buf.readBytes(s); |
| 1110 | return new String(s, CharsetUtil.UTF_8); |
| 1111 | } |
| 1112 | |
| 1113 | /** |
| 1114 | * De-serializes a protobuf from the given buffer. |
no test coverage detected