Example usage for org.apache.hadoop.fs FSExceptionMessages STREAM_IS_CLOSED

List of usage examples for org.apache.hadoop.fs FSExceptionMessages STREAM_IS_CLOSED

Introduction

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

Prototype

String STREAM_IS_CLOSED

To view the source code for org.apache.hadoop.fs FSExceptionMessages STREAM_IS_CLOSED.

Click Source Link

Document

The operation failed because the stream is closed:

Usage

From source file:com.aliyun.odps.volume.VolumeFSInputStream.java

License:Apache License

@Override
public int read(byte[] buf, int off, int len) throws IOException {
    // Inline to optimize performance
    if (closed) {
        throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
    }//w  w w  .j a v a2 s .c  om
    if (pos >= fileLength) {
        return VolumeFSConstants.EOF;
    }
    if (in == null || isSeeked || (seekOptimization && isCache && pos / blockSize != curIndex)) {
        in = getInputStream();
    }
    int avaliable = in.read(buf, off, len);
    pos = pos + avaliable;
    if (avaliable == len || pos >= fileLength) {
        return avaliable;
    } else {
        IOUtils.closeQuietly(in);
        in = null;
        return avaliable + read(buf, off + avaliable, len - avaliable);
    }
}

From source file:com.aliyun.odps.volume.VolumeFSInputStream.java

License:Apache License

private synchronized void checkClosed() throws IOException {
    if (closed) {
        throw new IOException(FSExceptionMessages.STREAM_IS_CLOSED);
    }//www  .  j  a  v  a 2 s.  c o m
}

From source file:com.ibm.stocator.fs.cos.COSInputStream.java

License:Apache License

/**
 * Verify that the input stream is open. Non blocking; this gives
 * the last state of the volatile {@link #closed} field.
 * @throws IOException if the connection is closed
 *///from   w  ww. ja  v  a 2s .  c o  m
private void checkNotClosed() throws IOException {
    if (closed) {
        throw new IOException(uri + ": " + FSExceptionMessages.STREAM_IS_CLOSED);
    }
}