Example usage for org.apache.hadoop.fs BufferedFSInputStream BufferedFSInputStream

List of usage examples for org.apache.hadoop.fs BufferedFSInputStream BufferedFSInputStream

Introduction

In this page you can find the example usage for org.apache.hadoop.fs BufferedFSInputStream BufferedFSInputStream.

Prototype

public BufferedFSInputStream(FSInputStream in, int size) 

Source Link

Document

Creates a BufferedFSInputStream with the specified buffer size, and saves its argument, the input stream in, for later use.

Usage

From source file:com.aliyun.fs.oss.nat.NativeOssFileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
    FileStatus fs = getFileStatus(f); // will throw if the file doesn't exist
    if (fs.isDir()) {
        throw new FileNotFoundException("'" + f + "' is a directory");
    }/*from  w  w w . j  a v  a 2s. c o  m*/
    LOG.info("Opening '" + f + "' for reading");
    Path absolutePath = makeAbsolute(f);
    String key = pathToKey(absolutePath);
    return new FSDataInputStream(new BufferedFSInputStream(new NativeOssFsInputStream(key), bufferSize));
}

From source file:com.facebook.presto.hive.PrestoS3FileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
    return new FSDataInputStream(new BufferedFSInputStream(
            new PrestoS3InputStream(s3, uri.getHost(), path, maxClientRetries), bufferSize));
}

From source file:com.facebook.presto.hive.s3.PrestoS3FileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
    return new FSDataInputStream(new BufferedFSInputStream(
            new PrestoS3InputStream(s3, getBucketName(uri), path, maxAttempts, maxBackoffTime, maxRetryTime),
            bufferSize));/*from ww w .  jav  a2  s.  c  o  m*/
}

From source file:com.qubole.rubix.core.CachingFileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
    FSDataInputStream inputStream = fs.open(path, bufferSize);

    if (skipCache(path, getConf())) {
        cacheSkipped = true;/*from  www  .j a  v  a2s. co m*/
        return inputStream;
    }

    return new FSDataInputStream(new BufferedFSInputStream(
            new CachingInputStream(inputStream, this, path, this.getConf(), statsMBean,
                    clusterManager.getSplitSize(), clusterManager.getClusterType()),
            CacheConfig.getBlockSize(getConf())));
}

From source file:com.quixey.hadoop.fs.oss.OSSFileSystem.java

License:Apache License

@Override
@Nonnull/*w ww  .ja  v  a  2  s.co  m*/
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
    path = checkNotNull(path);
    FileStatus fs = getFileStatus(path); // will throw if the file doesn't exist

    if (fs.isDirectory())
        throw new FileNotFoundException("'" + path + "' is a directory");
    LOG.info("Opening '{}' for reading", path);

    Path absolutePath = makeAbsolute(path);
    String key = pathToKey(absolutePath);
    return new FSDataInputStream(
            new BufferedFSInputStream(new OSSFileInputStream(store, key, of(statistics)), bufferSize));
}

From source file:com.rapleaf.ramhdfs.RamFileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
    if (!exists(f)) {
        throw new FileNotFoundException(f.toString());
    }/*from   ww w . ja  va 2  s  . c o m*/
    return new FSDataInputStream(
            new BufferedFSInputStream(new RamFSInputStream(pathToFileObject(f)), bufferSize));
}

From source file:com.splicemachine.fs.s3.PrestoS3FileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
    return new FSDataInputStream(new BufferedFSInputStream(
            new PrestoS3InputStream(s3, uri.getHost(), path, maxAttempts, maxBackoffTime, maxRetryTime),
            bufferSize));/*  w  ww  .  j  av a  2 s.  c o  m*/
}

From source file:com.uber.hoodie.common.table.log.HoodieLogFileReader.java

License:Apache License

HoodieLogFileReader(FileSystem fs, HoodieLogFile logFile, Schema readerSchema, int bufferSize,
        boolean readBlockLazily, boolean reverseReader) throws IOException {
    FSDataInputStream fsDataInputStream = fs.open(logFile.getPath(), bufferSize);
    if (fsDataInputStream.getWrappedStream() instanceof FSInputStream) {
        this.inputStream = new FSDataInputStream(
                new BufferedFSInputStream((FSInputStream) fsDataInputStream.getWrappedStream(), bufferSize));
    } else {//from  w  w w. j  av a  2s . c  om
        // fsDataInputStream.getWrappedStream() maybe a BufferedFSInputStream
        // need to wrap in another BufferedFSInputStream the make bufferSize work?
        this.inputStream = fsDataInputStream;
    }

    this.logFile = logFile;
    this.readerSchema = readerSchema;
    this.readBlockLazily = readBlockLazily;
    this.reverseReader = reverseReader;
    if (this.reverseReader) {
        this.reverseLogFilePosition = this.lastReverseLogFilePosition = fs.getFileStatus(logFile.getPath())
                .getLen();
    }
    addShutDownHook();
}

From source file:gobblin.source.extractor.extract.sftp.SftpLightWeightFileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path path, int bufferSize) throws IOException {
    SftpGetMonitor monitor = new SftpGetMonitor();
    try {//from   w ww. j a  va2s. co m
        ChannelSftp channelSftp = this.fsHelper.getSftpChannel();
        InputStream is = channelSftp.get(HadoopUtils.toUriPath(path), monitor);
        return new FSDataInputStream(
                new BufferedFSInputStream(new SftpFsHelper.SftpFsFileInputStream(is, channelSftp), bufferSize));
    } catch (SftpException e) {
        throw new IOException(e);
    }
}

From source file:io.prestosql.plugin.hive.s3.PrestoS3FileSystem.java

License:Apache License

@Override
public FSDataInputStream open(Path path, int bufferSize) {
    return new FSDataInputStream(new BufferedFSInputStream(
            new PrestoS3InputStream(s3, getBucketName(uri), path, maxAttempts, maxBackoffTime, maxRetryTime),
            bufferSize));//from  www .  j  a va  2  s . c o  m
}