Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.WriteOptions


  private void runFileFadvise(int advise, int expectedFadvise) throws Exception {
    nFadvise.set(0);
    InjectionHandler.set(new FadviseHandler(advise));
    DistributedFileSystem fs = (DistributedFileSystem) cluster.getFileSystem();
    WriteOptions options = new WriteOptions();
    options.setFadvise(advise);
    FSDataOutputStream out = fs.create(new Path("/test"), null, true, 1024,
        (short) 3, BLOCK_SIZE, 512, null, null, options);
    Random r = new Random();
    byte buffer[] = new byte[BLOCK_SIZE];
    r.nextBytes(buffer);
View Full Code Here


  public void tearDown() throws Exception {
    cluster.shutdown();
  }

  private OutputStream writeFile(int flags, int replication) throws Exception {
    WriteOptions options = new WriteOptions();
    options.setSyncFileRange(flags);
    OutputStream out = fs.create(new Path("/test1"), null, true, 1024,
        (short) replication, BLOCK_SIZE, 512, null, null, options);
    out.write(buffer, 0, buffer.length);
    ((FSDataOutputStream) out).sync();
    return out;
View Full Code Here

      long blockSize, Progressable progress, int buffersize,
      int bytesPerChecksum, boolean forceSync, boolean doParallelWrites,
      DatanodeInfo[] favoredNodes) throws IOException {
    this(dfsClient, src, masked, overwrite, createParent, replication,
        blockSize, progress, buffersize, bytesPerChecksum, forceSync,
        doParallelWrites, favoredNodes, new WriteOptions());
  }
View Full Code Here

  DFSOutputStream(DFSClient dfsClient, String src, int buffersize,
      Progressable progress, LocatedBlock lastBlock, FileStatus stat,
      int bytesPerChecksum, int namespaceId) throws IOException {
    this(dfsClient, src, stat.getBlockSize(), progress, bytesPerChecksum,
        stat.getReplication(), false, false, null,
        new WriteOptions());
    initialFileSize = stat.getLen(); // length of file when opened
    dfsClient.updateNamespaceIdIfNeeded(namespaceId);
    //
    // The last partial block of the file has to be filled.
    //
View Full Code Here

  public FSDataOutputStream create(Path f, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize,
      int bytesPerChecksum, Progressable progress,
      InetSocketAddress[] favoredNodes) throws IOException {
    return create(f, permission, overwrite, bufferSize, replication, blockSize,
        bytesPerChecksum, progress, favoredNodes, new WriteOptions());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.WriteOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.