Package eu.stratosphere.core.fs

Examples of eu.stratosphere.core.fs.FileStatus


    }

    // Check if the path is valid
    try {
      final FileSystem fs = this.path.getFileSystem();
      final FileStatus f = fs.getFileStatus(this.path);
      if (f == null) {
        throw new IOException(this.path.toString() + " led to a null object");
      }
    } catch (IOException e) {
      throw new IllegalConfigurationException("Cannot access file or directory: "
View Full Code Here


      return -1;
    }

    try {
      final FileSystem fs = this.path.getFileSystem();
      final FileStatus f = fs.getFileStatus(this.path);
      numberOfBlocks = fs.getNumberOfBlocks(f);

    } catch (IOException e) {
      return -1;
    }
View Full Code Here

    // Check if the path is valid
    try {
      final FileSystem fs = path.getFileSystem();

      try {
        final FileStatus f = fs.getFileStatus(path);

        if (f == null) {
          return 1;
        }

        // If the path points to a directory we allow an infinity number of subtasks
        if (f.isDir()) {
          return -1;
        }
      } catch (FileNotFoundException fnfex) {
        // The exception is thrown if the requested file/directory does not exist.
        // if the degree of parallelism is > 1, we create a directory for this path
View Full Code Here

      // Write out the actual path
      jar.write(out);

      // Write out the length of the file
      final FileStatus file = fs.getFileStatus(jar);
      out.writeLong(file.getLen());

      // Now write the jar file
      final FSDataInputStream inStream = fs.open(this.userJars.get(i));
      final byte[] buf = new byte[BUFFERSIZE];
      int read = inStream.read(buf, 0, buf.length);
View Full Code Here

    // get all the files that are involved in the splits
    final List<FileStatus> files = new ArrayList<FileStatus>();
    long totalLength = 0;

    final FileSystem fs = path.getFileSystem();
    final FileStatus pathFile = fs.getFileStatus(path);

    if (pathFile.isDir()) {
      // input is directory. list all contained files
      final FileStatus[] dir = fs.listStatus(path);
      for (int i = 0; i < dir.length; i++) {
        if (!dir[i].isDir()) {
          files.add(dir[i]);
          totalLength += dir[i].getLen();
        }
      }

    } else {
      files.add(pathFile);
      totalLength += pathFile.getLen();
    }

    final long minSplitSize = 1;
    final long maxSplitSize = (minNumSplits < 1) ? Long.MAX_VALUE : (totalLength / minNumSplits +
          (totalLength % minNumSplits == 0 ? 0 : 1));
View Full Code Here

      if (!fs.exists(storePath)) {
        throw new IOException(storePath + " does not exist!");
      }

      final FileStatus status = fs.getFileStatus(storePath);

      StringRecord.writeString(out, libraryFileName);
      out.writeLong(status.getLen());

      final FSDataInputStream inStream = fs.open(storePath);
      final byte[] buf = new byte[8192]; // 8K Buffer*/
      int read = inStream.read(buf, 0, buf.length);
      while (read > 0) {
View Full Code Here

  public FileInputSplit[] createInputSplits(int minNumSplits) throws IOException {
    int numAvroFiles = 0;
    final Path path = this.filePath;
    // get all the files that are involved in the splits
    final FileSystem fs = path.getFileSystem();
    final FileStatus pathFile = fs.getFileStatus(path);

    if (!acceptFile(pathFile)) {
      throw new IOException("The given file does not pass the file-filter");
    }
    if (pathFile.isDir()) {
      // input is directory. list all contained files
      final FileStatus[] dir = fs.listStatus(path);
      for (int i = 0; i < dir.length; i++) {
        if (!dir[i].isDir() && acceptFile(dir[i])) {
          numAvroFiles++;
View Full Code Here

    Path outputPath = getFileOutputPath();

    FileSystem fs = FileSystem.get(outputPath.toUri());
    if (fs.exists(outputPath)) {
      FileStatus status = fs.getFileStatus(outputPath);

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

    final FSDataOutputStream outputStream = fs.create(outputPath, true);
View Full Code Here

        fail("Cannot find entry " + bucketName + " in directory " + S3_BASE_URI);
      }

      // Check the concrete directory file status
      try {
        final FileStatus directoryFileStatus = fs.getFileStatus(bucketPath);
        assertTrue(directoryFileStatus.isDir());
        assertEquals(0L, directoryFileStatus.getAccessTime());
        assertTrue(directoryFileStatus.getModificationTime() > 0L);

      } catch (FileNotFoundException e) {
        fail(e.getMessage());
      }
View Full Code Here

      final OutputStream os = fs.create(file, true);
      generateTestData(os, SMALL_FILE_SIZE);
      os.close();

      final FileStatus fileStatus = fs.getFileStatus(file);
      assertNotNull(fileStatus);

      BlockLocation[] blockLocations = fs.getFileBlockLocations(fileStatus, 0, SMALL_FILE_SIZE + 1);
      assertNull(blockLocations);
View Full Code Here

TOP

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

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.