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:ReaderDataInput.java

public short readShort() throws IOException {

    int b1 = read();

    if (b1 < 0) {
        throw new EOFException();
    }//from w  w  w. j ava  2  s.com

    int b2 = read();

    if (b2 < 0) {
        throw new EOFException();
    }

    return (short) ((b1 << 8) | b2);
}

From source file:org.apache.tika.parser.wordperfect.WPInputStream.java

/**
 * Reads a WordPerfect character (8-bit).
 * @return character//from  w ww.j a  va  2 s .  co  m
 * @throws IOException if not enough bytes remain
 */
public char readWPChar() throws IOException {
    int c = in.read();
    if (c == -1) {
        throw new EOFException();
    }
    return (char) c;
}

From source file:org.bdval.io.compound.CompoundDataInput.java

/**
 * {@inheritDoc}//from  www.  j  a  v  a2  s  .  c o  m
 */
public byte readByte() throws IOException {
    --fileSize;
    if (fileSize < 0) {
        throw new EOFException();
    } else {
        return dataInput.readByte();
    }
}

From source file:com.norconex.importer.parser.impl.wordperfect.WPInputStream.java

/**
 * Reads a WordPerfect string of specified length (1 byte per character).
 * @param length how many characters to read
 * @return a string //from   w ww . j a v a2s.  c  o  m
 * @throws IOException if not enough bytes remain
 */
public String readWPString(int length) throws IOException {
    char[] chars = new char[length];
    for (int i = 0; i < length; i++) {
        int c = in.read();
        if (c == -1) {
            throw new EOFException();
        }
        chars[i] = (char) c;
    }
    return new String(chars);
}

From source file:org.bdval.io.compound.CompoundDataInput.java

/**
 * {@inheritDoc}/*from w ww.  ja v a 2s .co m*/
 */
public int readUnsignedByte() throws IOException {
    --fileSize;
    if (fileSize < 0) {
        throw new EOFException();
    }
    return dataInput.readUnsignedByte();
}

From source file:ReaderDataInput.java

public final int readUnsignedShort() throws IOException {

    int b1 = read();
    int b2 = read();

    if ((b1 | b2) < 0) {
        throw new EOFException();
    }//from   ww  w  .  ja  v a2 s. c o m

    return ((b1 << 8) + (b2));
}

From source file:org.bdval.io.compound.CompoundDataInput.java

/**
 * {@inheritDoc}//from ww w  . ja va  2s.co m
 */
public short readShort() throws IOException {
    fileSize -= 2;
    if (fileSize < 0) {
        throw new EOFException();
    }
    return dataInput.readShort();
}

From source file:ReaderDataInput.java

public final char readChar() throws IOException {

    int b1 = read();
    int b2 = read();

    if ((b1 | b2) < 0) {
        throw new EOFException();
    }/* w  ww.j a  v a2 s .  c om*/

    return (char) ((b1 << 8) + (b2));
}

From source file:org.bdval.io.compound.CompoundDataInput.java

/**
 * {@inheritDoc}//  w  ww .  j a va2 s  .  c o m
 */
public int readUnsignedShort() throws IOException {
    fileSize -= Short.SIZE;
    if (fileSize < 0) {
        throw new EOFException();
    }
    return dataInput.readUnsignedShort();
}

From source file:net.iponweb.hadoop.streaming.avro.IOWJsonDecoder.java

private void advance(Symbol symbol) throws IOException {
    this.parser.processTrailingImplicitActions();
    if (in.getCurrentToken() == null && this.parser.depth() == 1)
        throw new EOFException();
    parser.advance(symbol);//  www  . jav  a2 s .c om
}