本文整理汇总了Java中org.roaringbitmap.RoaringBitmap.serialize方法的典型用法代码示例。如果您正苦于以下问题:Java RoaringBitmap.serialize方法的具体用法?Java RoaringBitmap.serialize怎么用?Java RoaringBitmap.serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.roaringbitmap.RoaringBitmap
的用法示例。
在下文中一共展示了RoaringBitmap.serialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toByteBuffer
import org.roaringbitmap.RoaringBitmap; //导入方法依赖的package包/类
public static ByteBuffer toByteBuffer(RoaringBitmap rb) {
// we add tests
ByteBuffer outbb = ByteBuffer.allocate(rb.serializedSizeInBytes());
try {
rb.serialize(new DataOutputStream(new ByteBufferBackedOutputStream(outbb)));
} catch (IOException e) {
e.printStackTrace();
}
//
outbb.flip();
outbb.order(ByteOrder.LITTLE_ENDIAN);
return outbb;
}
示例2: _serialise
import org.roaringbitmap.RoaringBitmap; //导入方法依赖的package包/类
private void _serialise(final RoaringBitmap roaringBitmap, final JsonGenerator jsonGenerator) throws IOException {
jsonGenerator.writeObjectFieldStart(RoaringBitmapConstants.BITMAP_WRAPPER_OBJECT_NAME);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
roaringBitmap.serialize(new DataOutputStream(baos));
jsonGenerator.writeObjectField(RoaringBitmapConstants.BITMAP_VALUE_FIELD_NAME, baos.toByteArray());
baos.close();
jsonGenerator.writeEndObject();
}
示例3: serialise
import org.roaringbitmap.RoaringBitmap; //导入方法依赖的package包/类
@Override
public byte[] serialise(final RoaringBitmap object) throws SerialisationException {
final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
final DataOutputStream out = new DataOutputStream(byteOut);
try {
object.serialize(out);
} catch (final IOException e) {
throw new SerialisationException(e.getMessage(), e);
}
return byteOut.toByteArray();
}
示例4: serialize
import org.roaringbitmap.RoaringBitmap; //导入方法依赖的package包/类
@Override
public void serialize(RoaringBitmap bitmap, DataOutput dataOutput) throws Exception {
bitmap.serialize(dataOutput);
}