code = in.readUnsignedByte();
} catch (EOFException eof) {
return null;
}
if (code == Type.BYTES.code) {
return new Buffer(readBytes());
} else if (code == Type.BYTE.code) {
return readByte();
} else if (code == Type.BOOL.code) {
return readBool();
} else if (code == Type.INT.code) {
return readInt();
} else if (code == Type.SHORT.code) {
return readShort();
} else if (code == Type.LONG.code) {
return readLong();
} else if (code == Type.FLOAT.code) {
return readFloat();
} else if (code == Type.DOUBLE.code) {
return readDouble();
} else if (code == Type.STRING.code) {
return readString();
} else if (code == Type.VECTOR.code) {
return readVector();
} else if (code == Type.LIST.code) {
return readList();
} else if (code == Type.MAP.code) {
return readMap();
} else if (code == Type.MARKER.code) {
return null;
} else if (50 <= code && code <= 200) { // application-specific typecodes
return new Buffer(readBytes());
} else {
throw new RuntimeException("unknown type");
}
}