Java Code Examples for java.nio.BufferUnderflowException#getMessage()

The following examples show how to use java.nio.BufferUnderflowException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompactPersistentActionCache.java    From bazel with Apache License 2.0 6 votes vote down vote up
/**
 * @return non-null error description if indexer contains no data or integrity check has failed,
 *     and null otherwise
 */
private static String validateIntegrity(int indexerSize, byte[] validationRecord) {
  if (indexerSize == 0) {
    return "empty index";
  }
  if (validationRecord == null) {
    return "no validation record";
  }
  try {
    int validationSize = ByteBuffer.wrap(validationRecord).asIntBuffer().get();
    if (validationSize <= indexerSize) {
      return null;
    } else {
      return String.format("Validation mismatch: validation entry %d is too large " +
                           "compared to index size %d", validationSize, indexerSize);
    }
  } catch (BufferUnderflowException e) {
    return e.getMessage();
  }
}
 
Example 2
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public long readLong() throws IOException {
    try {
        return bb.getLong();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 3
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void readFully(byte b[], int off, int len) throws IOException {
    try {
        bb.get(b, off, len);
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 4
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int readInt() throws IOException {
    try {
        return bb.getInt();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 5
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public char readChar() throws IOException {
    try {
        return bb.getChar();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 6
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int readUnsignedShort() throws IOException {
    try {
        return ((int) bb.getShort()) & 0xffff;
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 7
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public double readDouble() throws IOException {
    try {
        return bb.getDouble();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 8
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int readUnsignedByte() throws IOException {
    try {
        return ((int) bb.get()) & 0xff;
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 9
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public float readFloat() throws IOException {
    try {
        return bb.getFloat();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 10
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean readBoolean() throws IOException {
    try {
        int ch = bb.get();
        return (ch != 0);
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 11
Source File: ModuleInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void readFully(byte b[], int off, int len) throws IOException {
    try {
        bb.get(b, off, len);
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 12
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public float readFloat() throws IOException {
    try {
        return bb.getFloat();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 13
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public long readLong() throws IOException {
    try {
        return bb.getLong();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 14
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public int readInt() throws IOException {
    try {
        return bb.getInt();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 15
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public char readChar() throws IOException {
    try {
        return bb.getChar();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 16
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public int readUnsignedShort() throws IOException {
    try {
        return ((int) bb.getShort()) & 0xffff;
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 17
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public short readShort() throws IOException {
    try {
        return bb.getShort();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 18
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public int readUnsignedByte() throws IOException {
    try {
        return ((int) bb.get()) & 0xff;
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 19
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public byte readByte() throws IOException {
    try {
        return bb.get();
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}
 
Example 20
Source File: ModuleInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public boolean readBoolean() throws IOException {
    try {
        int ch = bb.get();
        return (ch != 0);
    } catch (BufferUnderflowException e) {
        throw new EOFException(e.getMessage());
    }
}