Example usage for org.apache.hadoop.fs FsServerDefaults getFileBufferSize

List of usage examples for org.apache.hadoop.fs FsServerDefaults getFileBufferSize

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FsServerDefaults getFileBufferSize.

Prototype

public int getFileBufferSize() 

Source Link

Usage

From source file:org.apache.solr.store.hdfs.HdfsFileWriter.java

License:Apache License

public HdfsFileWriter(FileSystem fileSystem, Path path) throws IOException {
    LOG.debug("Creating writer on {}", path);
    this.path = path;

    Configuration conf = fileSystem.getConf();
    FsServerDefaults fsDefaults = fileSystem.getServerDefaults(path);
    EnumSet<CreateFlag> flags = EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE);
    if (Boolean.getBoolean(HDFS_SYNC_BLOCK)) {
        flags.add(CreateFlag.SYNC_BLOCK);
    }/*  w  w w  . j  a v a 2 s  . c  o m*/
    outputStream = fileSystem.create(path, FsPermission.getDefault().applyUMask(FsPermission.getUMask(conf)),
            flags, fsDefaults.getFileBufferSize(), fsDefaults.getReplication(), fsDefaults.getBlockSize(),
            null);
}