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


Java DataOutput.writeInt方法代码示例

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


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

示例1: write

import org.apache.lucene.store.DataOutput; //导入方法依赖的package包/类
private void write(DataOutput out) throws IOException {
    out.writeLong(offset);
    out.writeInt(numOps);
    out.writeLong(generation);
    out.writeLong(minSeqNo);
    out.writeLong(maxSeqNo);
    out.writeLong(globalCheckpoint);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:Checkpoint.java

示例2: serilaize

import org.apache.lucene.store.DataOutput; //导入方法依赖的package包/类
public static void serilaize(BloomFilter filter, DataOutput out) throws IOException {
    out.writeInt(0); // version
    BitArray bits = filter.bits;
    out.writeInt(bits.data.length);
    for (long l : bits.data) {
        out.writeLong(l);
    }
    out.writeInt(filter.numHashFunctions);
    out.writeInt(filter.hashing.type()); // hashType
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:BloomFilter.java

示例3: write

import org.apache.lucene.store.DataOutput; //导入方法依赖的package包/类
private void write(DataOutput out) throws IOException {
    out.writeLong(offset);
    out.writeInt(numOps);
    out.writeLong(generation);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:Checkpoint.java

示例4: writeHeader

import org.apache.lucene.store.DataOutput; //导入方法依赖的package包/类
/**
 * Writes a codec header, which records both a string to
 * identify the file and a version number. This header can
 * be parsed and validated with 
 * {@link #checkHeader(DataInput, String, int, int) checkHeader()}.
 * <p>
 * CodecHeader --&gt; Magic,CodecName,Version
 * <ul>
 *    <li>Magic --&gt; {@link DataOutput#writeInt Uint32}. This
 *        identifies the start of the header. It is always {@value #CODEC_MAGIC}.
 *    <li>CodecName --&gt; {@link DataOutput#writeString String}. This
 *        is a string to identify this file.
 *    <li>Version --&gt; {@link DataOutput#writeInt Uint32}. Records
 *        the version of the file.
 * </ul>
 * <p>
 * Note that the length of a codec header depends only upon the
 * name of the codec, so this length can be computed at any time
 * with {@link #headerLength(String)}.
 * 
 * @param out Output stream
 * @param codec String to identify this file. It should be simple ASCII, 
 *              less than 128 characters in length.
 * @param version Version number
 * @throws IOException If there is an I/O error writing to the underlying medium.
 */
public static void writeHeader(DataOutput out, String codec, int version)
  throws IOException {
  BytesRef bytes = new BytesRef(codec);
  if (bytes.length != codec.length() || bytes.length >= 128) {
    throw new IllegalArgumentException("codec must be simple ASCII, less than 128 characters in length [got " + codec + "]");
  }
  out.writeInt(CODEC_MAGIC);
  out.writeString(codec);
  out.writeInt(version);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:CodecUtil.java

示例5: serialize

import org.apache.lucene.store.DataOutput; //导入方法依赖的package包/类
/**
 * Serializes the data set to file using the following format:
 * <ul>
 *  <li>FuzzySet --&gt;FuzzySetVersion,HashFunctionName,BloomSize,
 * NumBitSetWords,BitSetWord<sup>NumBitSetWords</sup></li> 
 * <li>HashFunctionName --&gt; {@link DataOutput#writeString(String) String} The
 * name of a ServiceProvider registered {@link HashFunction}</li>
 * <li>FuzzySetVersion --&gt; {@link DataOutput#writeInt Uint32} The version number of the {@link FuzzySet} class</li>
 * <li>BloomSize --&gt; {@link DataOutput#writeInt Uint32} The modulo value used
 * to project hashes into the field's Bitset</li>
 * <li>NumBitSetWords --&gt; {@link DataOutput#writeInt Uint32} The number of
 * longs (as returned from {@link FixedBitSet#getBits})</li>
 * <li>BitSetWord --&gt; {@link DataOutput#writeLong Long} A long from the array
 * returned by {@link FixedBitSet#getBits}</li>
 * </ul>
 * @param out Data output stream
 * @throws IOException If there is a low-level I/O error
 */
public void serialize(DataOutput out) throws IOException
{
    out.writeInt(VERSION_CURRENT);
    out.writeInt(bloomSize);
    long[] bits = filter.getBits();
    out.writeInt(bits.length);
    for (int i = 0; i < bits.length; i++) {
      // Can't used VLong encoding because cant cope with negative numbers
      // output by FixedBitSet
      out.writeLong(bits[i]);
    }
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:FuzzySet.java


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