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

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

Introduction

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

Prototype

String NEGATIVE_SEEK

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

Click Source Link

Document

Negative offset seek forbidden :

Usage

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

License:Apache License

@Override
public synchronized void seek(long pos) throws IOException {
    checkClosed();/* ww w  .  j  a  va 2  s.co  m*/
    if (pos < 0) {
        throw new EOFException(FSExceptionMessages.NEGATIVE_SEEK);
    }
    if (pos > fileLength) {
        throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);
    }
    this.pos = pos;
    this.isSeeked = true;
}

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

License:Apache License

@Override
public synchronized void seek(long targetPos) throws IOException {
    checkNotClosed();//from   w  ww  .  j  a  v a  2s . c o m

    // Do not allow negative seek
    if (targetPos < 0) {
        throw new EOFException(FSExceptionMessages.NEGATIVE_SEEK + " " + targetPos);
    }

    if (contentLength <= 0) {
        return;
    }

    // Lazy seek
    nextReadPos = targetPos;
}