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


Java BufferedFileDataOutputStream类代码示例

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


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

示例1: write

import com.indeed.util.io.BufferedFileDataOutputStream; //导入依赖的package包/类
/**
 * @param path root lsm tree index directory
 * @param iterator the iterator
 * @param keySerializer the key serializer
 * @param valueSerializer the value serializer
 * @param blocksize block size
 * @param keepDeletions true to keep deletion
 * @param <K> the key type
 * @param <V> the value type
 * @throws IOException  if an I/O error occurs
 */
public static <K, V> void write(
        Path path,
        Iterator<Generation.Entry<K,V>> iterator,
        Serializer<K> keySerializer,
        Serializer<V> valueSerializer,
        final int blocksize,
        boolean keepDeletions
) throws IOException {
    if (blocksize > 65536) throw new IllegalArgumentException("block size must be less than 65536");
    Files.createDirectories(path);
    final BufferedFileDataOutputStream fileOut = new BufferedFileDataOutputStream(path.resolve("index.bin"));
    final CountingOutputStream out = new CountingOutputStream(fileOut);
    //tempFile is deleted in writeIndex
    final Path tempPath = Files.createTempFile("tmp", ".bin");
    final WriteLevelResult result = writeLevel(out, tempPath, iterator, keySerializer, valueSerializer, blocksize, keepDeletions);
    final int tmpCount = result.tmpCount;
    final long size = result.size;

    final long valueLevelLength = out.getCount();
    final Header header = writeIndex(out, tempPath, tmpCount, keySerializer, blocksize);
    header.valueLevelLength = valueLevelLength;
    header.size = size;
    header.hasDeletions = keepDeletions;
    new HeaderSerializer().write(header, new LittleEndianDataOutputStream(out));
    fileOut.sync();
    out.close();
}
 
开发者ID:indeedeng,项目名称:lsmtree,代码行数:39,代码来源:ImmutableBTreeIndex.java

示例2: writeStringToFile

import com.indeed.util.io.BufferedFileDataOutputStream; //导入依赖的package包/类
/**
 * Writes a string to a file, overwriting it if it exists.
 *
 * @param f             file to write
 * @param str           value to store
 * @throws IOException  if an I/O error occurs
 */
public static void writeStringToFile(File f, String str) throws IOException {
    File nextPath = new File(f.getParentFile(), f.getName()+".next");
    BufferedFileDataOutputStream out = new BufferedFileDataOutputStream(nextPath);
    out.write(str.getBytes(Charsets.UTF_8));
    out.sync();
    out.close();
    nextPath.renameTo(f);
}
 
开发者ID:indeedeng,项目名称:lsmtree,代码行数:16,代码来源:GenericRecordLogAppender.java

示例3: open

import com.indeed.util.io.BufferedFileDataOutputStream; //导入依赖的package包/类
public static <E> Writer<E> open(File file, Serializer<E> serializer, CompressionCodec codec, int blockSize, int recordIndexBits, int padBits) throws FileNotFoundException {
    final SyncableDataOutput out = new BufferedFileDataOutputStream(file, ByteOrder.BIG_ENDIAN, 16384);
    return new Writer<E>(out, serializer, codec, blockSize, recordIndexBits, padBits);
}
 
开发者ID:indeedeng,项目名称:lsmtree,代码行数:5,代码来源:BlockCompressedRecordFile.java

示例4: Writer

import com.indeed.util.io.BufferedFileDataOutputStream; //导入依赖的package包/类
public Writer(File file, Serializer<E> serializer) throws FileNotFoundException {
    this.serializer = serializer;
    out = new BufferedFileDataOutputStream(file, ByteOrder.BIG_ENDIAN, 65536);
}
 
开发者ID:indeedeng,项目名称:lsmtree,代码行数:5,代码来源:BasicRecordFile.java


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