if (unpacker.hasNext() && unpacker.getNextFormat().getValueType().isArrayType())
ValueType type = format.getValueType(); int length; ExtensionTypeHeader extension;
/** * Create an exception for the case when an unexpected byte value is read * * @param expected * @param b * @return * @throws MessageFormatException */ private static MessagePackException unexpected(String expected, byte b) { MessageFormat format = MessageFormat.valueOf(b); if (format == MessageFormat.NEVER_USED) { return new MessageNeverUsedFormatException(String.format("Expected %s, but encountered 0xC1 \"NEVER_USED\" byte", expected)); } else { String name = format.getValueType().name(); String typeName = name.substring(0, 1) + name.substring(1).toLowerCase(); return new MessageTypeException(String.format("Expected %s, but got %s (%02x)", expected, typeName, b)); } }
private BElement unpackAny(MessageUnpacker unpacker) throws IOException { var format = unpacker.getNextFormat(); switch (format.getValueType()) { case ARRAY: return unpackArray(unpacker); case MAP: return unpackMap(unpacker); case BINARY: case BOOLEAN: case FLOAT: case INTEGER: case NIL: case STRING: return unpackValue(format, unpacker); case EXTENSION: default: break; } throw new InvalidTypeException("Cannot deserialize as BElement for format: " + format); }
ValueType type = format.getValueType(); int length; ExtensionTypeHeader extension;
ValueType valueType = messageUnpacker.getNextFormat().getValueType();
switch (mf.getValueType()) { case NIL: readByte();
private BValue unpackValue(MessageFormat format, MessageUnpacker unpacker) throws IOException { var value = this.getFactory().newValue(); switch (format.getValueType()) { case BINARY: int len = unpacker.unpackBinaryHeader();
switch (mf.getValueType()) { case NIL: readByte();