• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Value类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.msgpack.value.Value的典型用法代码示例。如果您正苦于以下问题:Java Value类的具体用法?Java Value怎么用?Java Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Value类属于org.msgpack.value包,在下文中一共展示了Value类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processPacket

import org.msgpack.value.Value; //导入依赖的package包/类
public byte[] processPacket(Pair<SphinxHeader, byte[]> packet, BigInteger privk)
        throws SphinxException, IOException, CryptoException {
    SphinxProcessData sphinxProcessData = packer.decryptSphinxPacket(packet, privk);
    byte routingFlag = sphinxProcessData.routing[0];
    if (routingFlag == SphinxClient.DEST_FLAG) {
        Value value = packer.handleReceivedForward(sphinxProcessData.delta);
        ArrayValue outerTuple = value.asArrayValue();
        ArrayValue destination = outerTuple.get(0).asArrayValue();
        byte[] message = outerTuple.get(1).asBinaryValue().asByteArray();
        if (isDestinationSelf(destination)) {
            return message;
        } else {
            throw new RuntimeException("Received message not meant for us");
        }
    }
    throw new RuntimeException("Processed non-destination packet");
}
 
开发者ID:cheahjs,项目名称:JLoopix,代码行数:18,代码来源:ClientCore.java


示例2: send

import org.msgpack.value.Value; //导入依赖的package包/类
/***
 * Sends a msgpack message to the provider.
 * @param val msgpack encoded message
 */
private synchronized void send(Value val) {
    logger.debug("Sending packet", val);
    if (!session.isConnected())
        logger.warn("Trying to send when session is not connected.");
    Packer packer = Packer.getPacker();
    try {
        packer.packValue(val);
    } catch (IOException e) {
        throw new RuntimeException("Failed to pack value");
    }
    byte[] encodedPacket = packer.toByteArray();
    IoBuffer buffer = IoBuffer.allocate(encodedPacket.length);
    buffer.put(encodedPacket);
    buffer.flip();
    session.write(buffer);
}
 
开发者ID:cheahjs,项目名称:JLoopix,代码行数:21,代码来源:LoopixClient.java


示例3: getRouting

import org.msgpack.value.Value; //导入依赖的package包/类
private List<byte[]> getRouting(List<LoopixNode> path, boolean dropFlag, Object typeFlag) throws IOException {
    List<byte[]> routing = new LinkedList<>();
    for (int i = 0; i < path.size(); i++) {
        LoopixNode node = path.get(i);
        double delay = generateRandomDelay();
        boolean drop = (i == path.size() - 1) && dropFlag;
        routing.add(SphinxClient.Nenc(new ImmutableArrayValueImpl(new Value[] {
            new ImmutableArrayValueImpl(new Value[] {
                    new ImmutableStringValueImpl(node.host),
                    new ImmutableLongValueImpl(node.port)
            }),
                drop ? ImmutableBooleanValueImpl.TRUE : ImmutableBooleanValueImpl.FALSE,
                ImmutableNilValueImpl.get(),
                new ImmutableDoubleValueImpl(delay),
                new ImmutableStringValueImpl(node.name)
        })));
    }
    return routing;
}
 
开发者ID:cheahjs,项目名称:JLoopix,代码行数:20,代码来源:SphinxPacker.java


示例4: unpackEcPoint

import org.msgpack.value.Value; //导入依赖的package包/类
public static ECPoint unpackEcPoint(Value value) throws IOException {
    if (!value.isExtensionValue())
        throw new RuntimeException("Expected extension value");

    ExtensionValue extValue = value.asExtensionValue();
    if (extValue.getType() != 2)
        throw new RuntimeException("Expected ecpoint value");

    byte[] data = extValue.getData();

    MessageUnpacker unpacker = MessagePack.DEFAULT_UNPACKER_CONFIG.newUnpacker(data);
    ArrayValue array = unpacker.unpackValue().asArrayValue();
    int id = array.get(0).asIntegerValue().asInt();
    // We only support secp224r1 at the moment.
    assert id == 713;
    byte[] ecData = array.get(1).asBinaryValue().asByteArray();
    ECPoint point = new GroupECC().EcSpec.getCurve().decodePoint(ecData);
    return point;
}
 
开发者ID:cheahjs,项目名称:JLoopix,代码行数:20,代码来源:Unpacker.java


示例5: ParquetArrayConverter

import org.msgpack.value.Value; //导入依赖的package包/类
private ParquetArrayConverter(GroupType schema, ParentContainerUpdater updater)
{
    super(updater);

    Type repeatedType = schema.getType(0);
    if (isElementType(repeatedType, schema.getName())) {
        // If the repeated field corresponds to the element type, creates a new converter using the
        // type of the repeated field.
        elementConverter = newConverter(repeatedType, new ParentContainerUpdater.Noop() {
            @Override
            public void set(Value value)
            {
                ParquetArrayConverter.this.currentArray.add(value);
            }
        });
    }
    else {
        // If the repeated field corresponds to the syntactic group in the standard 3-level Parquet
        // LIST layout, creates a new converter using the only child field of the repeated field.
        elementConverter = new ElementConverter(repeatedType.asGroupType().getType(0));
    }
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:23,代码来源:ParquetValueConverter.java


示例6: RepeatedPrimitiveConverter

import org.msgpack.value.Value; //导入依赖的package包/类
public RepeatedPrimitiveConverter(Type parquetType, final ParentContainerUpdater parentUpdater)
{
    this.updater = new ParentContainerUpdater.Noop() {
        @Override
        public void start()
        {
            RepeatedPrimitiveConverter.this.currentArray = new ArrayList<>();
        }

        @Override
        public void end()
        {
            parentUpdater.set(ValueFactory.newArray(RepeatedPrimitiveConverter.this.currentArray));
        }

        @Override
        public void set(Value value)
        {
            RepeatedPrimitiveConverter.this.currentArray.add(value);
        }
    };

    this.elementConverter = newConverter(parquetType, getUpdater()).asPrimitiveConverter();
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:25,代码来源:ParquetValueConverter.java


示例7: RepeatedGroupConverter

import org.msgpack.value.Value; //导入依赖的package包/类
public RepeatedGroupConverter(Type parquetType, final ParentContainerUpdater parentUpdater)
{
    this.updater = new ParentContainerUpdater.Noop() {
        @Override
        public void start()
        {
            RepeatedGroupConverter.this.currentArray = new ArrayList<>();
        }

        @Override
        public void end()
        {
            parentUpdater.set(ValueFactory.newArray(RepeatedGroupConverter.this.currentArray));
        }

        @Override
        public void set(Value value)
        {
            RepeatedGroupConverter.this.currentArray.add(value);
        }
    };

    this.elementConverter = newConverter(parquetType, getUpdater()).asGroupConverter();
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:25,代码来源:ParquetValueConverter.java


示例8: newComplexInnerValue

import org.msgpack.value.Value; //导入依赖的package包/类
private Value newComplexInnerValue(int i)
{
    return newArray(
            newMap(
                    newString("nestedIntsColumn"), newArray(newInteger(i + 0 + 0), newInteger(i + 0 + 1), newInteger(i + 0 + 2)),
                    newString("nestedStringColumn"), newString("val_" + (i + 0))
            ),
            newMap(
                    newString("nestedIntsColumn"), newArray(newInteger(i + 1 + 0), newInteger(i + 1 + 1), newInteger(i + 1 + 2)),
                    newString("nestedStringColumn"), newString("val_" + (i + 1))
            ),
            newMap(
                    newString("nestedIntsColumn"), newArray(newInteger(i + 2 + 0), newInteger(i + 2 + 1), newInteger(i + 2 + 2)),
                    newString("nestedStringColumn"), newString("val_" + (i + 2))
            )
    );
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:18,代码来源:TestParquetThriftCompatibility.java


示例9: read

import org.msgpack.value.Value; //导入依赖的package包/类
public List<Value> read() throws IOException
{
    spark.conf().set(SQLConf$.MODULE$.PARQUET_WRITE_LEGACY_FORMAT().key(), isLegacyFormat);

    Dataset<Row> dataFrame = spark.createDataFrame(data, schema).repartition(1);
    File file = new File(SparkTestBase.this.tempFolder.getRoot(), name);
    dataFrame.write().options(options).parquet(file.getPath());

    ArrayList<Value> results = new ArrayList<>();
    try (ParquetReader<Value> reader = ParquetReader
            .builder(new MessagePackReadSupport(), new Path(file.getPath()))
            .build()) {
        Value v;
        while ((v = reader.read()) != null) {
            results.add(v);
        }
    }
    return results;
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:20,代码来源:SparkTestBase.java


示例10: asBoolean

import org.msgpack.value.Value; //导入依赖的package包/类
public static boolean asBoolean(Value value) throws DataException
{
    if (value.isBooleanValue()) {
        return value.asBooleanValue().getBoolean();
    }
    else if (value.isIntegerValue()) {
        return LongCast.asBoolean(value.asIntegerValue().asLong());
    }
    else if (value.isFloatValue()) {
        return DoubleCast.asBoolean(value.asFloatValue().toDouble());
    }
    else if (value.isStringValue()) {
        return StringCast.asBoolean(value.asStringValue().asString());
    }
    else {
        return JsonCast.asBoolean(value);
    }
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-parser-jsonpath,代码行数:19,代码来源:ColumnCaster.java


示例11: asLong

import org.msgpack.value.Value; //导入依赖的package包/类
public static long asLong(Value value) throws DataException
{
    if (value.isBooleanValue()) {
        return BooleanCast.asLong(value.asBooleanValue().getBoolean());
    }
    else if (value.isIntegerValue()) {
        return value.asIntegerValue().asLong();
    }
    else if (value.isFloatValue()) {
        return DoubleCast.asLong(value.asFloatValue().toDouble());
    }
    else if (value.isStringValue()) {
        return StringCast.asLong(value.asStringValue().asString());
    }
    else {
        return JsonCast.asLong(value);
    }
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-parser-jsonpath,代码行数:19,代码来源:ColumnCaster.java


示例12: asDouble

import org.msgpack.value.Value; //导入依赖的package包/类
public static double asDouble(Value value) throws DataException
{
    if (value.isBooleanValue()) {
        return BooleanCast.asDouble(value.asBooleanValue().getBoolean());
    }
    else if (value.isIntegerValue()) {
        return LongCast.asDouble(value.asIntegerValue().asLong());
    }
    else if (value.isFloatValue()) {
        return value.asFloatValue().toDouble();
    }
    else if (value.isStringValue()) {
        return StringCast.asDouble(value.asStringValue().asString());
    }
    else {
        return JsonCast.asDouble(value);
    }
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-parser-jsonpath,代码行数:19,代码来源:ColumnCaster.java


示例13: asTimestamp

import org.msgpack.value.Value; //导入依赖的package包/类
public static Timestamp asTimestamp(Value value, TimestampParser parser) throws DataException
{
    if (value.isBooleanValue()) {
        return BooleanCast.asTimestamp(value.asBooleanValue().getBoolean());
    }
    else if (value.isIntegerValue()) {
        return LongCast.asTimestamp(value.asIntegerValue().asLong());
    }
    else if (value.isFloatValue()) {
        return DoubleCast.asTimestamp(value.asFloatValue().toDouble());
    }
    else if (value.isStringValue()) {
        return StringCast.asTimestamp(value.asStringValue().asString(), parser);
    }
    else {
        return JsonCast.asTimestamp(value);
    }
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-parser-jsonpath,代码行数:19,代码来源:ColumnCaster.java


示例14: unpackAttribute

import org.msgpack.value.Value; //导入依赖的package包/类
private Attribute unpackAttribute(String attributeName, MessageUnpacker unpacker) throws Exception {
    if ( ! unpacker.hasNext() ) {
        throw new IllegalArgumentException("Premature end of message pack stream");
    }
    Value value = unpacker.unpackValue();
    if ( value.isBinaryValue() ) {
        return new Attribute().withName(attributeName).withValue(value.asBinaryValue().asByteArray());
    } else if ( value.isFloatValue() ) {
        return new Attribute().withName(attributeName).withValue(value.asFloatValue().toDouble());
    } else if ( value.isIntegerValue() ) {
        IntegerValue intVal = value.asIntegerValue();
        if ( intVal.isInLongRange() ) {
            return new Attribute().withName(attributeName).withValue(intVal.asLong());
        } else {
            return new Attribute().withName(attributeName).withValue(intVal.asBigInteger());
        }
    } else if ( value.isStringValue() ) {
        return new Attribute().withName(attributeName).withValue(value.asStringValue().asString());
    } else {
        throw new UnsupportedOperationException("Message pack stream contained '"+value.getValueType()+"' type, but that type is not supported");
    }
}
 
开发者ID:Distelli,项目名称:java-persistence,代码行数:23,代码来源:GenericConvertMarker.java


示例15: stringColumn

import org.msgpack.value.Value; //导入依赖的package包/类
@Override
public void stringColumn(Column outputColumn)
{
    String json_column_name = task.getJsonColumn().getName();
    if (json_column_name.equals(outputColumn.getName())) {
        Value value = visitor.visit(parse_tree);
        if (value.isNilValue()) {
            pageBuilder.setNull(outputColumn);
        }
        else {
            pageBuilder.setString(outputColumn, value.toString());
        }
    }
    else {
        Column inputColumn = inputSchema.lookupColumn(outputColumn.getName());
        if (pageReader.isNull(inputColumn)) {
            pageBuilder.setNull(outputColumn);
        }
        else {
            pageBuilder.setString(outputColumn, pageReader.getString(inputColumn));
        }
    }
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-filter-build_json,代码行数:24,代码来源:BuildJsonVisitorImpl.java


示例16: jsonColumn

import org.msgpack.value.Value; //导入依赖的package包/类
@Override
public void jsonColumn(Column outputColumn)
{
    String json_column_name = task.getJsonColumn().getName();
    if (json_column_name.equals(outputColumn.getName())) {
        Value value = visitor.visit(parse_tree);

        if (value.isNilValue()) {
            pageBuilder.setNull(outputColumn);
        }
        else {
            pageBuilder.setJson(outputColumn, value);
        }
    }
    else {
        Column inputColumn = inputSchema.lookupColumn(outputColumn.getName());
        if (pageReader.isNull(inputColumn)) {
            pageBuilder.setNull(outputColumn);
        }
        else {
            pageBuilder.setJson(outputColumn, pageReader.getJson(inputColumn));
        }
    }
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-filter-build_json,代码行数:25,代码来源:BuildJsonVisitorImpl.java


示例17: fromBoolean

import org.msgpack.value.Value; //导入依赖的package包/类
public Value fromBoolean(Type outputType, BooleanValue value)
{
    if (outputType instanceof BooleanType) {
        return value;
    }
    else if (outputType instanceof LongType) {
        return ValueFactory.newInteger(BooleanCast.asLong(value.getBoolean()));
    }
    else if (outputType instanceof DoubleType) {
        return ValueFactory.newFloat(BooleanCast.asDouble(value.getBoolean()));
    }
    else if (outputType instanceof StringType) {
        return ValueFactory.newString(BooleanCast.asString(value.getBoolean()));
    }
    else if (outputType instanceof JsonType) {
        return BooleanCast.asJson(value.getBoolean());
    }
    else {
        assert (false);
        return null;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:23,代码来源:JsonCaster.java


示例18: fromLong

import org.msgpack.value.Value; //导入依赖的package包/类
public Value fromLong(Type outputType, IntegerValue value)
{
    if (outputType instanceof BooleanType) {
        return ValueFactory.newBoolean(LongCast.asBoolean(value.asLong()));
    }
    else if (outputType instanceof LongType) {
        return value;
    }
    else if (outputType instanceof DoubleType) {
        return ValueFactory.newFloat(LongCast.asDouble(value.asLong()));
    }
    else if (outputType instanceof StringType) {
        return ValueFactory.newString(LongCast.asString(value.asLong()));
    }
    else if (outputType instanceof JsonType) {
        return LongCast.asJson(value.asLong());
    }
    else {
        assert false;
        return null;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:23,代码来源:JsonCaster.java


示例19: fromDouble

import org.msgpack.value.Value; //导入依赖的package包/类
public Value fromDouble(Type outputType, FloatValue value)
{
    if (outputType instanceof BooleanType) {
        return ValueFactory.newBoolean(DoubleCast.asBoolean(value.toDouble()));
    }
    else if (outputType instanceof LongType) {
        return ValueFactory.newInteger(DoubleCast.asLong(value.toDouble()));
    }
    else if (outputType instanceof DoubleType) {
        return value;
    }
    else if (outputType instanceof StringType) {
        return ValueFactory.newString(DoubleCast.asString(value.toDouble()));
    }
    else if (outputType instanceof JsonType) {
        return DoubleCast.asJson(value.toDouble());
    }
    else {
        assert (false);
        return null;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:23,代码来源:JsonCaster.java


示例20: fromString

import org.msgpack.value.Value; //导入依赖的package包/类
public Value fromString(Type outputType, StringValue value)
{
    if (outputType instanceof BooleanType) {
        return ValueFactory.newBoolean(StringCast.asBoolean(value.asString()));
    }
    else if (outputType instanceof LongType) {
        return ValueFactory.newInteger(StringCast.asLong(value.asString()));
    }
    else if (outputType instanceof DoubleType) {
        return ValueFactory.newFloat(StringCast.asDouble(value.asString()));
    }
    else if (outputType instanceof StringType) {
        return value;
    }
    else if (outputType instanceof JsonType) {
        return StringCast.asJson(value.asString());
    }
    else {
        assert false;
        return null;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:23,代码来源:JsonCaster.java



注:本文中的org.msgpack.value.Value类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultAnnotationHover类代码示例发布时间:2022-05-21
下一篇:
Java ComponentConnector类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap