Examples of EOFException


Examples of java.io.EOFException

                } else if (element.equals(insertStartMarker)) {
                    // Skip the previous auto-generated content
                    while (true) {
                        current = reader.read();
                        if (current < 0) {
                            throw new EOFException();
                        }
                        if (current == '<') {
                            element = getElement(reader);
                            if (element.equals(insertEndMarker)) {
                                break;
View Full Code Here

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

Examples of java.io.EOFException

                    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

Examples of java.io.EOFException

        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

Examples of java.io.EOFException

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

Examples of java.io.EOFException

    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

Examples of java.io.EOFException

    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

Examples of java.io.EOFException

            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

Examples of java.io.EOFException

        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

Examples of java.io.EOFException

    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
TOP
Copyright © 2018 www.massapi.com. 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.