public Value decodeNextValue () {
		byte type = stream.readUInt8();
		byte typeNumber = (byte)(type & 7);
		switch (typeNumber) {
			case Value.KBValueTypeTerminator:
				return null;
			case Value.KBValueTypeInteger:
				return new IntegerValue(stream, type);
			case Value.KBValueTypeFloating:
				return new DoubleValue(stream, type);
			case Value.KBValueTypeArray:
				return new ArrayValue(stream, type);
			case Value.KBValueTypeUTF8String:
				return new StringValue(stream, type);
			case Value.KBValueTypeData:
				return new DataValue(stream, type);
			case Value.KBValueTypeDictionary:
				return new MapValue(stream, type);
			case Value.KBValueTypeNull:
				return new NullValue(stream, type);
			default:
				throw new UnmatchedTypeException("Failed to find class matching type:" + (type & 0xff));
		}
	}