Package java.io

Examples of java.io.EOFException


       
        while (!done) {
            int current = reader.read();
            while (current != '>') {
                if (current < 0) {
                    throw new EOFException();
                }
                result.append((char) current);
                current = reader.read();
            }
            result.append((char) current);
View Full Code Here


                    int length = (int)raf.length();
                    byte buf[] = new byte[8192];
                    while (length > 0) {
                        int r = raf.read(buf, 0, Math.min(buf.length, length));
                        if (r < 0)
                            throw new EOFException("Unexpected EOF");
                        originalout.write(buf, 0, r);
                        length -= r;
                    }
                }
            }
View Full Code Here

        public void flush() throws IOException {
            buffer.flip();
            while (buffer.remaining() > 0) {
                selector.select();
                if (!selector.isOpen()) {
                    throw new EOFException();
                }
                socket.write(buffer);
            }
            buffer.clear();
        }
View Full Code Here

            }
            inPos = pos;
        }
        int l = IOUtils.readFully(in, b, off, len);
        if (l != len) {
            throw new EOFException();
        }
        pos += len;
        inPos += len;
    }
View Full Code Here

    public static void readFully(final FileChannel channel, final ByteBuffer dst, final long position)
            throws IOException {
        while(dst.remaining() > 0) {
            if(-1 == channel.read(dst, position + dst.position())) {
                throw new EOFException();
            }
        }
    }
View Full Code Here

    public static void writeFully(final WritableByteChannel channel, final ByteBuffer buf)
            throws IOException {
        do {
            int written = channel.write(buf);
            if(written < 0) {
                throw new EOFException();
            }
        } while(buf.hasRemaining());
    }
View Full Code Here

            throws IOException {
        int written = 0;
        do {
            final int n = channel.write(buf);
            if(n < 0) {
                throw new EOFException();
            }
            written += n;
        } while(buf.hasRemaining());
        return written;
    }
View Full Code Here

        try {
            mapped.position(pos);
            mapped.get(b, off, len);
            pos += len;
        } catch (IllegalArgumentException e) {
            EOFException e2 = new EOFException("EOF");
            e2.initCause(e);
            throw e2;
        } catch (BufferUnderflowException e) {
            EOFException e2 = new EOFException("EOF");
            e2.initCause(e);
            throw e2;
        }
    }
View Full Code Here

    final FastBufferedInputStream fbis = new FastBufferedInputStream( rawContent );
    int startedHeader = 0; // 0 == false, 1 == true, 2 === header started and uri collected
    boolean foundDocNo = false;
   
    int l = fbis.readLine( buffer );
    if ( l < 0 ) throw new EOFException();
    if ( ! TRECDocumentCollection.equals( buffer, l, DOC_OPEN  ) ) throw new IllegalStateException ( "Document does not start with <DOC>: " + new String( buffer, 0, l ) );
   
    while ( ( l = fbis.readLine( buffer ) ) != -1 ) {
      if ( !foundDocNo && startsWith( buffer, l, DOCNO_OPEN ) ) {
        foundDocNo = true;
View Full Code Here

            format = in.read();
        } catch (IOException ioe) {
            throw new FormatException(ioe.getMessage());
        }
        if (format == -1) {
            throw new EOFException();
        }

        try {
            currentTileKey = readIntegerByKey(in, format >> 6);
            nextTileID = readIntegerByKey(in, format >> 4);
View Full Code Here

TOP

Related Classes of java.io.EOFException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.