public boolean readBoolean() { final byte headerByte = buffer.getByte(offset); ++offset; final boolean theBool; switch (headerByte) { case TRUE: theBool = true; break; case FALSE: theBool = false; break; default: throw exceptionOnUnknownHeader("boolean", headerByte); } return theBool; }
public boolean readBoolean() { final byte headerByte = buffer.getByte(offset); ++offset; final boolean theBool; switch (headerByte) { case TRUE: theBool = true; break; case FALSE: theBool = false; break; default: throw exceptionOnUnknownHeader("boolean", headerByte); } return theBool; }
/** * Float is the term in the msgpack spec for all values represented by Java types float and double * * @return the value */ public strictfp double readFloat() { final byte headerByte = buffer.getByte(offset); ++offset; final double value; switch (headerByte) { case FLOAT32: value = buffer.getFloat(offset, BYTE_ORDER); offset += 4; break; case FLOAT64: value = buffer.getDouble(offset, BYTE_ORDER); offset += 8; break; default: throw exceptionOnUnknownHeader("float", headerByte); } return value; }
/** * Float is the term in the msgpack spec for all values represented by Java types float and double * * @return the value */ public strictfp double readFloat() { final byte headerByte = buffer.getByte(offset); ++offset; final double value; switch (headerByte) { case FLOAT32: value = buffer.getFloat(offset, BYTE_ORDER); offset += 4; break; case FLOAT64: value = buffer.getDouble(offset, BYTE_ORDER); offset += 8; break; default: throw exceptionOnUnknownHeader("float", headerByte); } return value; }
public int readMapHeader() { final byte headerByte = buffer.getByte(offset); ++offset; final int mapSize; if (isFixedMap(headerByte)) { mapSize = headerByte & (byte) 0x0F; } else { switch (headerByte) { case MAP16: mapSize = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case MAP32: mapSize = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("map", headerByte); } } return mapSize; }
public int readArrayHeader() { final byte headerByte = buffer.getByte(offset); ++offset; final int mapSize; if (isFixedArray(headerByte)) { mapSize = headerByte & (byte) 0x0F; } else { switch (headerByte) { case ARRAY16: mapSize = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case ARRAY32: mapSize = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("array", headerByte); } } return mapSize; }
public int readBinaryLength() { final int length; final byte headerByte = buffer.getByte(offset); ++offset; switch (headerByte) { case BIN8: length = buffer.getByte(offset) & 0xff; ++offset; break; case BIN16: length = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case BIN32: length = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("binary", headerByte); } return length; }
public int readBinaryLength() { final int length; final byte headerByte = buffer.getByte(offset); ++offset; switch (headerByte) { case BIN8: length = buffer.getByte(offset) & 0xff; ++offset; break; case BIN16: length = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case BIN32: length = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("binary", headerByte); } return length; }
public int readMapHeader() { final byte headerByte = buffer.getByte(offset); ++offset; final int mapSize; if (isFixedMap(headerByte)) { mapSize = headerByte & (byte) 0x0F; } else { switch (headerByte) { case MAP16: mapSize = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case MAP32: mapSize = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("map", headerByte); } } return mapSize; }
public int readArrayHeader() { final byte headerByte = buffer.getByte(offset); ++offset; final int mapSize; if (isFixedArray(headerByte)) { mapSize = headerByte & (byte) 0x0F; } else { switch (headerByte) { case ARRAY16: mapSize = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case ARRAY32: mapSize = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("array", headerByte); } } return mapSize; }
public int readStringLength() { final byte headerByte = buffer.getByte(offset); ++offset; final int stringLength; if (isFixStr(headerByte)) { stringLength = headerByte & (byte) 0x1F; } else { switch (headerByte) { case STR8: stringLength = buffer.getByte(offset) & 0xff; ++offset; break; case STR16: stringLength = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case STR32: stringLength = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("string", headerByte); } } return stringLength; }
public int readStringLength() { final byte headerByte = buffer.getByte(offset); ++offset; final int stringLength; if (isFixStr(headerByte)) { stringLength = headerByte & (byte) 0x1F; } else { switch (headerByte) { case STR8: stringLength = buffer.getByte(offset) & 0xff; ++offset; break; case STR16: stringLength = buffer.getShort(offset, BYTE_ORDER) & 0xffff; offset += SIZE_OF_SHORT; break; case STR32: stringLength = (int) ensurePositive(buffer.getInt(offset, BYTE_ORDER)); offset += SIZE_OF_INT; break; default: throw exceptionOnUnknownHeader("string", headerByte); } } return stringLength; }