Examples of EOFException


Examples of java.io.EOFException

        int tag = _in.read();
        if (tag == -1)
        {
            if (_eofFound)
            {
                throw new EOFException("attempt to read past end of file.");
            }

            _eofFound = true;

            return null;
        }

        //
        // turn of looking for "00" while we resolve the tag
        //
        set00Check(false);

        //
        // calculate tag number
        //
        int baseTagNo = tag & ~DERTags.CONSTRUCTED;
        int tagNo = baseTagNo;

        if ((tag & DERTags.TAGGED) != 0)
        {
            tagNo = tag & 0x1f;

            //
            // with tagged object tag number is bottom 5 bits, or stored at the start of the content
            //
            if (tagNo == 0x1f)
            {
                tagNo = 0;

                int b = _in.read();

                while ((b >= 0) && ((b & 0x80) != 0))
                {
                    tagNo |= (b & 0x7f);
                    tagNo <<= 7;
                    b = _in.read();
                }

                if (b < 0)
                {
                    _eofFound = true;

                    throw new EOFException("EOF encountered inside tag value.");
                }

                tagNo |= (b & 0x7f);
            }
        }
View Full Code Here

Examples of java.io.EOFException

    public void readFully(byte[] b, int off, int len) throws IOException {
        if (len == 0) {
            return;
        }
        if (channel.position() + len > length) {
            throw new EOFException();
        }
        ByteBuffer buf = ByteBuffer.wrap(b);
        buf.position(off);
        buf.limit(off + len);
        channel.read(buf);
View Full Code Here

Examples of java.io.EOFException

                changeLength(end);
            } else {
                if (len == 0) {
                    return pos;
                }
                throw new EOFException("File: " + name);
            }
        }
        while (len > 0) {
            int l = (int) Math.min(len, BLOCK_SIZE - (pos & BLOCK_SIZE_MASK));
            int page = (int) (pos >>> BLOCK_SIZE_SHIFT);
View Full Code Here

Examples of java.io.EOFException

        return l;
    }

    public void readFully(byte[] b, int off, int len) throws IOException {
        if (filePointer + len > length) {
            throw new EOFException();
        }
        while (true) {
            int l = read(b, off, len);
            len -= l;
            if (len <= 0) {
View Full Code Here

Examples of java.io.EOFException

     * Read data from our channel into the buffer
     */
    final int read = this.in.read(this.buffer);

    if (read == -1) {
      throw new EOFException();
    }

    if (read < length) {
      throw new BufferUnderflowException();
    }
View Full Code Here

Examples of java.io.EOFException

    public static void skipFully(InputStream in, long skip) throws IOException {
        try {
            while (skip > 0) {
                long skipped = in.skip(skip);
                if (skipped <= 0) {
                    throw new EOFException();
                }
                skip -= skipped;
            }
        } catch (Exception e) {
            throw DbException.convertToIOException(e);
View Full Code Here

Examples of java.io.EOFException

    public static void skipFully(Reader reader, long skip) throws IOException {
        try {
            while (skip > 0) {
                long skipped = reader.skip(skip);
                if (skipped <= 0) {
                    throw new EOFException();
                }
                skip -= skipped;
            }
        } catch (Exception e) {
            throw DbException.convertToIOException(e);
View Full Code Here

Examples of java.io.EOFException

     * the file
     */
    public short readShort() throws EOFException {
        //MSBFirst must be set when we are called
        if (iv_bytesinbuffer < 2) {
            throw new EOFException();
        }
        iv_curptr += 2;
        iv_bytesinbuffer -= 2;
        return MoreMath.BuildShort(iv_buffer, iv_curptr - 2, true);
    }
View Full Code Here

Examples of java.io.EOFException

     */
    public short readLEShort() throws IOException {
        int byte1 = in.read();
        int byte2 = in.read();
        if (byte2 == -1)
            throw new EOFException();
        return (short) ((byte2 << 8) + byte1);
    }
View Full Code Here

Examples of java.io.EOFException

     */
    public int readLEUnsignedShort() throws IOException {
        int byte1 = in.read();
        int byte2 = in.read();
        if (byte2 == -1)
            throw new EOFException();
        return (byte2 << 8) + byte1;
    }
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.