Example usage for java.io EOFException EOFException

List of usage examples for java.io EOFException EOFException

Introduction

In this page you can find the example usage for java.io EOFException EOFException.

Prototype

public EOFException() 

Source Link

Document

Constructs an EOFException with null as its error detail message.

Usage

From source file:CSVReader.java

/**
 * Make sure a line is available for parsing.
 * Does nothing if there already is one.
 *
 * @exception EOFException//  ww w. j a  v  a2 s.  c  om
 */
private void readLine() throws EOFException, IOException {
    if (line == null) {
        line = r.readLine(); /* this strips platform specific line ending */
        if (line == null) {
            /* null means EOF, yet another inconsistent Java convention. */
            throw new EOFException();
        } else {
            line += '\n'; /* apply standard line end for parser to find */
            lineCount++;
        }
    }
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public boolean readBoolean() throws IOException {
    int val = read();
    if (val < 0) {
        throw new EOFException();
    }//from  ww w  .ja va  2s .c om
    return (val != 0);
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public byte readByte() throws IOException {
    int val = read();
    if (val < 0) {
        throw new EOFException();
    }//from  ww  w .  j  a  va 2 s.  co m
    return (byte) (val);
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public int readUnsignedByte() throws IOException {
    int val = read();
    if (val < 0) {
        throw new EOFException();
    }//from  w w w  .  j  av a 2  s.c  om
    return val;
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public short readShort() throws IOException {
    int val1 = read();
    int val2 = read();
    if ((val1 | val2) < 0) {
        throw new EOFException();
    }/*  w w  w  .  j av  a 2s.  com*/
    return (short) ((val1 << 8) + (val2 << 0));
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public int readUnsignedShort() throws IOException {
    int val1 = read();
    int val2 = read();
    if ((val1 | val2) < 0) {
        throw new EOFException();
    }//  www  . j  a  v a  2  s.c  om
    return (val1 << 8) + (val2 << 0);
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public char readChar() throws IOException {
    int val1 = read();
    int val2 = read();
    if ((val1 | val2) < 0) {
        throw new EOFException();
    }//  w w w.j  a v  a  2s  .co  m
    return (char) ((val1 << 8) + (val2 << 0));
}

From source file:org.apache.tajo.storage.v2.ScheduledInputStream.java

@Override
public int readInt() throws IOException {
    int val1 = read();
    int val2 = read();
    int val3 = read();
    int val4 = read();
    if ((val1 | val2 | val3 | val4) < 0) {
        throw new EOFException();
    }//from w  ww. jav  a 2 s.c o m
    return ((val1 << 24) + (val2 << 16) + (val3 << 8) + (val4 << 0));
}

From source file:org.apache.sshd.server.command.ScpCommand.java

protected int readAck(boolean canEof) throws IOException {
    int c = in.read();
    switch (c) {/*from   w w w  . j  ava 2  s .  c o  m*/
    case -1:
        if (!canEof) {
            throw new EOFException();
        }
        break;
    case OK:
        break;
    case WARNING:
        log.warn("Received warning: " + readLine());
        break;
    case ERROR:
        throw new IOException("Received nack: " + readLine());
    default:
        break;
    }
    return c;
}

From source file:org.commoncrawl.hadoop.io.deprecated.ArcFileReader.java

private static int readUByte(InputStream in) throws IOException {
    int b = in.read();
    if (b == -1) {
        throw new EOFException();
    }/*from   w  w w . j  a  v a 2 s. c om*/
    if (b < -1 || b > 255) {
        // Report on this.in, not argument in; see read{Header, Trailer}.
        throw new IOException("read() returned value out of range -1..255: " + b);
    }
    return b;
}