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


Java ByteArrayDataOutput.writeBytes方法代码示例

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


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

示例1: binaryValue

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
@Override
public BytesRef binaryValue() {
    try {
        CollectionUtils.sortAndDedup(bytesList);
        int size = bytesList.size();
        final byte[] bytes = new byte[totalSize + (size + 1) * 5];
        ByteArrayDataOutput out = new ByteArrayDataOutput(bytes);
        out.writeVInt(size);  // write total number of values
        for (int i = 0; i < size; i ++) {
            final byte[] value = bytesList.get(i);
            int valueLength = value.length;
            out.writeVInt(valueLength);
            out.writeBytes(value, 0, valueLength);
        }
        return new BytesRef(bytes, 0, out.getPosition());
    } catch (IOException e) {
        throw new ElasticsearchException("Failed to get binary value", e);
    }

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:BinaryFieldMapper.java

示例2: binaryValue

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
@Override
public BytesRef binaryValue() {
    try {
        CollectionUtils.sortAndDedup(bytesList);
        final int size = bytesList.size();
        final byte[] bytes = new byte[totalSize + (size + 1) * 5];
        final ByteArrayDataOutput out = new ByteArrayDataOutput(bytes);
        out.writeVInt(size); // write total number of values
        for (int i = 0; i < size; i++) {
            final byte[] value = bytesList.get(i);
            final int valueLength = value.length;
            out.writeVInt(valueLength);
            out.writeBytes(value, 0, valueLength);
        }
        return new BytesRef(bytes, 0, out.getPosition());
    } catch (final IOException e) {
        throw new ElasticsearchException("Failed to get binary value",
                e);
    }

}
 
开发者ID:sherlok,项目名称:sherlastic,代码行数:22,代码来源:SherlokFieldMapper.java

示例3: binaryValue

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
@Override
public BytesRef binaryValue() {
    try {
        CollectionUtils.sortAndDedup(bytesList);
        final int size = bytesList.size();
        final byte[] bytes = new byte[totalSize + (size + 1) * 5];
        final ByteArrayDataOutput out = new ByteArrayDataOutput(bytes);
        out.writeVInt(size); // write total number of values
        for (int i = 0; i < size; i++) {
            final byte[] value = bytesList.get(i);
            final int valueLength = value.length;
            out.writeVInt(valueLength);
            out.writeBytes(value, 0, valueLength);
        }
        return new BytesRef(bytes, 0, out.getPosition());
    } catch (final IOException e) {
        throw new ElasticsearchException("Failed to get MinHash value",
                e);
    }

}
 
开发者ID:codelibs,项目名称:elasticsearch-minhash,代码行数:22,代码来源:MinHashFieldMapper.java

示例4: encode

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
@Override
protected void encode(ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, BytesRef payload, Set<BytesRef> contexts, long weight) throws IOException {
  if (spare.length + 4 >= buffer.length) {
    buffer = ArrayUtil.grow(buffer, spare.length + 4);
  }
  output.reset(buffer);
  output.writeBytes(spare.bytes, spare.offset, spare.length);
  output.writeInt(encodeWeight(weight));
  writer.write(buffer, 0, output.getPosition());
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:WFSTCompletionLookup.java

示例5: encode

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
/** encodes an entry (bytes+weight) to the provided writer */
protected void encode(ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, long weight) throws IOException {
  if (spare.length + 8 >= buffer.length) {
    buffer = ArrayUtil.grow(buffer, spare.length + 8);
  }
  output.reset(buffer);
  output.writeBytes(spare.bytes, spare.offset, spare.length);
  output.writeLong(weight);
  writer.write(buffer, 0, output.getPosition());
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:SortedTermFreqIteratorWrapper.java

示例6: encode

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
@Override
protected void encode(ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, long weight) throws IOException {
  if (spare.length + 4 >= buffer.length) {
    buffer = ArrayUtil.grow(buffer, spare.length + 4);
  }
  output.reset(buffer);
  output.writeBytes(spare.bytes, spare.offset, spare.length);
  output.writeInt(encodeWeight(weight));
  writer.write(buffer, 0, output.getPosition());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:11,代码来源:WFSTCompletionLookup.java

示例7: encode

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
@Override
protected void encode(ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, BytesRef payload, long weight) throws IOException {
  if (spare.length + 4 >= buffer.length) {
    buffer = ArrayUtil.grow(buffer, spare.length + 4);
  }
  output.reset(buffer);
  output.writeBytes(spare.bytes, spare.offset, spare.length);
  output.writeInt(encodeWeight(weight));
  writer.write(buffer, 0, output.getPosition());
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:WFSTCompletionLookup.java

示例8: encode

import org.apache.lucene.store.ByteArrayDataOutput; //导入方法依赖的package包/类
/** encodes an entry (bytes+(payload)+weight) to the provided writer */
protected void encode(ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, BytesRef payload, long weight) throws IOException {
  int requiredLength = spare.length + 8 + ((hasPayloads) ? 2 + payload.length : 0);
  if (requiredLength >= buffer.length) {
    buffer = ArrayUtil.grow(buffer, requiredLength);
  }
  output.reset(buffer);
  output.writeBytes(spare.bytes, spare.offset, spare.length);
  if (hasPayloads) {
    output.writeBytes(payload.bytes, payload.offset, payload.length);
    output.writeShort((short) payload.length);
  }
  output.writeLong(weight);
  writer.write(buffer, 0, output.getPosition());
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:16,代码来源:SortedInputIterator.java


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