Package eu.stratosphere.core.fs

Examples of eu.stratosphere.core.fs.FSDataOutputStream


    }
    public Path call()  {
      Path tmp = getTempDir(jobID, name);
      try {
        if (!lfs.exists(tmp)) {
          FSDataOutputStream lfsOutput = lfs.create(tmp, false);
          Path distributedPath = new Path(filePath);
          FileSystem fs = distributedPath.getFileSystem();
          FSDataInputStream fsInput = fs.open(distributedPath);
          IOUtils.copyBytes(fsInput, lfsOutput);
        }
View Full Code Here


    synchronized (this.fs) {

      // Check if file already exists in our library cache, if not write it to the cache directory
      if (!fs.exists(storePath)) {
        final FSDataOutputStream fos = fs.create(storePath, false);
        fos.write(buf, 0, buf.length);
        fos.close();
      }
    }
  }
View Full Code Here

    synchronized (this.fs) {

      // Check if file already exists in our library cache, if not write it to the cache directory
      if (!this.fs.exists(storePath)) {
        final FSDataOutputStream fos = this.fs.create(storePath, false);
        fos.write(buf, 0, buf.length);
        fos.close();
      }
    }

    // Create mapping for client path and cache name
    final LibraryTranslationKey key = new LibraryTranslationKey(jobID, name);
View Full Code Here

      if (status.isDir()) {
        outputPath = new Path(outputPath.toUri().toString() + "/file_" + getIndexInSubtaskGroup() + ".txt");
      }
    }

    final FSDataOutputStream outputStream = fs.create(outputPath, true);

    while (this.input.hasNext()) {

      StringRecord record = this.input.next();
      byte[] recordByte = (record.toString() + "\r\n").getBytes();
      outputStream.write(recordByte, 0, recordByte.length);
    }

    outputStream.close();

  }
View Full Code Here

    // Create test bucket
    fs.mkdirs(bucketPath);

    // Write test file to S3
    final FSDataOutputStream outputStream = fs.create(objectPath, false);
    generateTestData(outputStream, fileSize);
    outputStream.close();

    // Now read the same file back from S3
    final FSDataInputStream inputStream = fs.open(objectPath);
    testReceivedData(inputStream, fileSize);
    inputStream.close();
View Full Code Here

  }


  @Override
  public void close() throws IOException {
    final FSDataOutputStream s = this.stream;
    if (s != null) {
      this.stream = null;
      s.close();
    }
  }
View Full Code Here

          throw new IllegalArgumentException("Invalid write mode: "+writeMode);
        }
       
        // check for canceling and close the stream in that case, because no one will obtain it
        if (this.aborted) {
          final FSDataOutputStream f = this.fdos;
          this.fdos = null;
          f.close();
        }
      }
      catch (Throwable t) {
        this.error = t;
      }
View Full Code Here

    /**
     * Double checked procedure setting the abort flag and closing the stream.
     */
    private final void abortWait() {
      this.aborted = true;
      final FSDataOutputStream outStream = this.fdos;
      this.fdos = null;
      if (outStream != null) {
        try {
          outStream.close();
        } catch (Throwable t) {}
      }
    }
View Full Code Here

      /*
       * check that lfs can create/read/write from/to files properly and read meta information..
       */

      // create files.. one ""natively"", one using lfs
      final FSDataOutputStream lfsoutput1 = lfs.create(pathtotestfile1, false);
      testfile2.createNewFile();

      // does lfs create files? does lfs recognize created files?
      assertTrue(testfile1.exists());
      assertTrue(lfs.exists(pathtotestfile2));

      // test that lfs can write to files properly
      final byte[] testbytes = { 1, 2, 3, 4, 5 };
      lfsoutput1.write(testbytes);
      lfsoutput1.close();

      assertEquals(testfile1.length(), 5l);

      final FileInputStream fisfile1 = new FileInputStream(testfile1);
      byte[] testbytestest = new byte[5];
View Full Code Here

TOP

Related Classes of eu.stratosphere.core.fs.FSDataOutputStream

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.