Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FSDataOutputStream.writeByte()


    // Start writing a file with 2 replicas to ensure each datanode has one.
    // Block Size is 1MB.
    String src = FILE_NAME_PREFIX + "test_quota1";
    FSDataOutputStream fout = fs.create(new Path(src), true, 4096, (short)2, 1024 * 1024);
    for (int i = 0; i < 1024; i++) {
      fout.writeByte(123);
    }

    // Shutdown one datanode, causing the block abandonment.
    cluster.getDataNodes().get(0).shutdown();

View Full Code Here


    final boolean mc)
  throws IOException {
    Path p = getInfoFilePath();
    FSDataOutputStream out = filesystem.create(p);
    try {
      out.writeByte(INFO_SEQ_NUM);
      out.writeLong(infonum);
      if (mc) {
        // Set whether major compaction flag on this file.
        this.majorCompaction = mc;
        out.writeByte(MAJOR_COMPACTION);
View Full Code Here

      out.writeByte(INFO_SEQ_NUM);
      out.writeLong(infonum);
      if (mc) {
        // Set whether major compaction flag on this file.
        this.majorCompaction = mc;
        out.writeByte(MAJOR_COMPACTION);
        out.writeBoolean(mc);
      }
    } finally {
      out.close();
    }
View Full Code Here

   */
  void writeInfo(FileSystem fs, long infonum) throws IOException {
    Path p = getInfoFilePath();
    FSDataOutputStream out = fs.create(p);
    try {
      out.writeByte(INFO_SEQ_NUM);
      out.writeLong(infonum);
    } finally {
      out.close();
    }
  }
View Full Code Here

   */
  void writeInfo(FileSystem fs, long infonum) throws IOException {
    Path p = getInfoFilePath();
    FSDataOutputStream out = fs.create(p);
    try {
      out.writeByte(INFO_SEQ_NUM);
      out.writeLong(infonum);
    } finally {
      out.close();
    }
  }
View Full Code Here

   */
  void writeInfo(FileSystem fs, long infonum) throws IOException {
    Path p = getInfoFilePath();
    FSDataOutputStream out = fs.create(p);
    try {
      out.writeByte(INFO_SEQ_NUM);
      out.writeLong(infonum);
    } finally {
      out.close();
    }
  }
View Full Code Here

   */
  void writeInfo(FileSystem fs, long infonum) throws IOException {
    Path p = getInfoFilePath();
    FSDataOutputStream out = fs.create(p);
    try {
      out.writeByte(INFO_SEQ_NUM);
      out.writeLong(infonum);
    } finally {
      out.close();
    }
  }
View Full Code Here

    // rename bar --> bar2
    final Path bar2 = new Path(foo, "bar2");
    hdfs.rename(bar, bar2);
    // append file and keep it as underconstruction.
    FSDataOutputStream out = hdfs.append(bar2);
    out.writeByte(0);
    ((DFSOutputStream) out.getWrappedStream()).hsync(
        EnumSet.of(SyncFlag.UPDATE_LENGTH));

    // save namespace and restart
    restartClusterAndCheckImage(true);
View Full Code Here

    return new RecordWriter() {
        public synchronized void write(WritableComparable key, Writable value)
          throws IOException {
          out.write(key.toString().getBytes("UTF-8"));
          out.writeByte('\t');
          out.write(value.toString().getBytes("UTF-8"));
          out.writeByte('\n');
        }
        public synchronized void close(Reporter reporter) throws IOException {
          out.close();
View Full Code Here

        public synchronized void write(WritableComparable key, Writable value)
          throws IOException {
          out.write(key.toString().getBytes("UTF-8"));
          out.writeByte('\t');
          out.write(value.toString().getBytes("UTF-8"));
          out.writeByte('\n');
        }
        public synchronized void close(Reporter reporter) throws IOException {
          out.close();
        }
      };
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.