Example usage for org.apache.hadoop.hdfs DFSOutputStream getInitialLen

List of usage examples for org.apache.hadoop.hdfs DFSOutputStream getInitialLen

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs DFSOutputStream getInitialLen.

Prototype

public long getInitialLen() 

Source Link

Document

Returns the size of a file as it was when this stream was opened

Usage

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Append to an existing HDFS file./*from w  w  w  . j av  a 2  s  .co m*/
 * 
 * @param src
 *            file name
 * @param buffersize
 *            buffer size
 * @param flag
 *            indicates whether to append data to a new block instead of
 *            the last block
 * @param progress
 *            for reporting write-progress; null is acceptable.
 * @param statistics
 *            file system statistics; null is acceptable.
 * @return an output stream for writing into the file
 * 
 * @see ClientProtocol#append(String, String, EnumSetWritable)
 */
public HdfsDataOutputStream append(final String src, final int buffersize, EnumSet<CreateFlag> flag,
        final Progressable progress, final FileSystem.Statistics statistics) throws IOException {
    final DFSOutputStream out = append(src, buffersize, flag, null, progress);
    return createWrappedOutputStream(out, statistics, out.getInitialLen());
}

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Append to an existing HDFS file./*from   ww  w .ja  va  2s.c o m*/
 * 
 * @param src
 *            file name
 * @param buffersize
 *            buffer size
 * @param flag
 *            indicates whether to append data to a new block instead of the
 *            last block
 * @param progress
 *            for reporting write-progress; null is acceptable.
 * @param statistics
 *            file system statistics; null is acceptable.
 * @param favoredNodes
 *            FavoredNodes for new blocks
 * @return an output stream for writing into the file
 * @see ClientProtocol#append(String, String, EnumSetWritable)
 */
public HdfsDataOutputStream append(final String src, final int buffersize, EnumSet<CreateFlag> flag,
        final Progressable progress, final FileSystem.Statistics statistics,
        final InetSocketAddress[] favoredNodes) throws IOException {
    final DFSOutputStream out = append(src, buffersize, flag, getFavoredNodesStr(favoredNodes), progress);
    return createWrappedOutputStream(out, statistics, out.getInitialLen());
}