当前位置: 首页>>代码示例>>Java>>正文


Java BsonBinary.getData方法代码示例

本文整理汇总了Java中org.bson.BsonBinary.getData方法的典型用法代码示例。如果您正苦于以下问题:Java BsonBinary.getData方法的具体用法?Java BsonBinary.getData怎么用?Java BsonBinary.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bson.BsonBinary的用法示例。


在下文中一共展示了BsonBinary.getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import org.bson.BsonBinary; //导入方法依赖的package包/类
@Override
protected Collection<Byte> decode(BsonBinary bsonValue) {
	final Collection<Byte> value = getInstance();
	for(byte bsonByte : bsonValue.getData()) {
		value.add(bsonByte);
	}
	return value;
}
 
开发者ID:JPDSousa,项目名称:mongo-obj-framework,代码行数:9,代码来源:ByteCollectionCodec.java

示例2: decode

import org.bson.BsonBinary; //导入方法依赖的package包/类
@Override
public Binary decode(BsonValue bsonValue) {
    BsonBinary bsonBinary = bsonValue.asBinary();
    return new Binary(bsonBinary.getType(), bsonBinary.getData());
}
 
开发者ID:welkinbai,项目名称:BsonMapper,代码行数:6,代码来源:BsonBinaryConverter.java

示例3: decode

import org.bson.BsonBinary; //导入方法依赖的package包/类
@Override
protected byte[] decode(BsonBinary value) {
	return value.getData();
}
 
开发者ID:JPDSousa,项目名称:mongo-obj-framework,代码行数:5,代码来源:PrimitiveByteArrayCodec.java

示例4: writeBinary

import org.bson.BsonBinary; //导入方法依赖的package包/类
private void writeBinary(BsonReader reader, final MapOrListWriterImpl writer, String fieldName, boolean isList) {
  final VarBinaryHolder vb = new VarBinaryHolder();
  BsonBinary readBinaryData = reader.readBinaryData();
  byte[] data = readBinaryData.getData();
  Byte type = (Byte) readBinaryData.getType();
  // Based on specified binary type, cast it accordingly
  switch (type.intValue()) {
  case 1:
    // Double 1
    writeDouble(ByteBuffer.wrap(data).getDouble(), writer, fieldName, isList);
    break;
  case 2:
    // String 2
    writeString(new String(data), writer, fieldName, isList);
    break;
  case 8:
    // Boolean 8
    boolean boolValue = (data == null || data.length == 0) ? false : data[0] != 0x00;
    writeBoolean(boolValue, writer, fieldName, isList);
    break;
  case 9:
    // Date 9
    writeDateTime(ByteBuffer.wrap(data).getLong(), writer, fieldName, isList);
    break;
  case 13:
    // JavaScript 13
    writeString(new String(data), writer, fieldName, isList);
    break;
  case 14:
    // Symbol 14
    writeString(new String(data), writer, fieldName, isList);
    break;
  case 15:
    // JavaScript (with scope) 15
    writeString(new String(data), writer, fieldName, isList);
    break;
  case 16:
    // 32-bit integer 16
    writeInt32(ByteBuffer.wrap(data).getInt(), writer, fieldName, isList);
    break;
  case 17:
    // Timestamp 17
    writeTimeStamp(ByteBuffer.wrap(data).getInt(), writer, fieldName, isList);
    break;
  case 18:
    // 64-bit integer 18
    writeInt64(ByteBuffer.wrap(data).getInt(), writer, fieldName, isList);
    break;
  default:
    // In case of Object(3)/Binary data (5)/Object id (7) or in other case
    // considering as VarBinary
    final byte[] bytes = readBinaryData.getData();
    writeBinary(writer, fieldName, isList, vb, bytes);
    break;
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:57,代码来源:BsonRecordReader.java


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