Java 8 EOFException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 EOFException class.

This code example shows how to use the following methods:
    } 
 
    @Override 
    public byte readByte() throws IOException { 
        if (!buffer.hasRemaining()) {
            throw new EOFException();
        } 
        return buffer.get();
    } 
 
    @Override 
    public int read(byte[] b, int off, int len) throws IOException {
        if (!buffer.hasRemaining()) {
            return -1; 
        } 
 
        len = Math.min(len, buffer.remaining());
        buffer.get(b, off, len);
        return len;
    } 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    @Override 
    public byte readByte() throws IOException { 
        int ch = is.read();
        if (ch < 0)
            throw new EOFException();
        return (byte) (ch);
    } 
 
    @Override 
    public void readBytes(byte[] b, int offset, int len) throws IOException {
        if (len < 0)
            throw new IndexOutOfBoundsException();
        final int read = Streams.readFully(is, b, offset, len);
        if (read != len) {
            throw new EOFException();
        } 
    } 
 
    @Override 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    @Override 
    public byte readByte() throws IOException {
        int ch = is.read();
        if (ch < 0)
            throw new EOFException();
        return (byte) (ch);
    } 
 
    @Override 
    public void readBytes(byte[] b, int offset, int len) throws IOException {
        if (len < 0)
            throw new IndexOutOfBoundsException();
        final int read = Streams.readFully(is, b, offset, len);
        if (read != len) {
            throw new EOFException();
        } 
    } 
 
    @Override 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    @Override 
    public void readBytes(byte[] b, int offset, int len) throws IOException {
        int read = read(b, offset, len);
        if (read < len) {
            throw new EOFException();
        } 
    } 
 
    @Override 
    public void close() throws IOException { 
        // nothing to do here 
    } 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    @Override 
    public byte readByte() throws IOException {
        if (!buffer.hasRemaining()) {
            throw new EOFException();
        } 
        return buffer.get();
    } 
 
    @Override 
    public int read(byte[] b, int off, int len) throws IOException {
        if (!buffer.hasRemaining()) {
            return -1; 
        } 
 
        len = Math.min(len, buffer.remaining());
        buffer.get(b, off, len);
        return len;
    } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    @Override 
    public byte readByte() throws IOException { 
        if (pos >= count) {
            throw new EOFException();
        } 
        return buf[pos++];
    } 
 
    @Override 
    public void readBytes(byte[] b, int offset, int len) throws IOException {
        if (len == 0) {
            return; 
        } 
        if (pos >= count) {
            throw new EOFException();
        } 
        if (pos + len > count) {
            len = count - pos;
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    @Override 
    public void readBytes(byte[] b, int offset, int len) throws IOException {
        int read = read(b, offset, len);
        if (read < len) {
            throw new EOFException();
        } 
    } 
 
    @Override 
    public void close() throws IOException {
        // nothing to do here 
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    if (result >= 0) {
      --remaining;
    } else if (remaining > 0) {
      // Underlying stream reached EOF but we haven't read the expected 
      // number of bytes. 
      throw new EOFException(
          "Premature EOF. Expected " + remaining + "more bytes");
    } 
    return result;
  } 
 
  @Override 
  public int read(final byte[] b, final int off, int len)
                  throws IOException { 
    if (remaining <= 0) {
      return -1; 
    } 
    len = Math.min(len, remaining);
    final int result = super.read(b, off, len);
    if (result >= 0) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } else if (len == 0) {
      return; 
    } 
 
    if (currentPointer + len > limit) {
      throw new EOFException("Reach the limit of the buffer");
    } 
 
    System.arraycopy(b, off, buffer, currentPointer, len);
    currentPointer += len;
  } 
 
  /** 
   * Reset the limit  
   * @param newlim New Limit 
   */ 
  public void reset(int newlim) {
    if (newlim > (buffer.length - startOffset)) {
      throw new IndexOutOfBoundsException("Limit exceeds buffer size");
    } 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    @Override 
    public byte readByte() throws IOException { 
        if (!readyBuffer()) { 
            throw new EOFException();
        } 
        return uncompressed[position++];
    } 
 
    @Override 
    public int read(byte[] buffer, int offset, int length) throws IOException {
        return read(buffer, offset, length, false);
    } 
 
    public int read(byte[] buffer, int offset, int length, boolean fullRead) throws IOException {
        if (length < 1) {
            return 0; 
        } 
        if (!readyBuffer()) { 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Java 8 EOFException Questions & Answers:

See Code Examples for Java 8 EOFException Methods: