@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
/** * Reads a single byte from the source stream and returns it as an integer * in the range from 0 to 255. Returns -1 if the end of the source stream * has been reached. Blocks if no input is available. * * @return the byte read or -1 if the end of the source stream has been * reached. * @throws IOException * if an error occurs while reading from this stream. */ @Override public int read() throws IOException { checkReadPrimitiveTypes(); return primitiveData.read(); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
/** * Skips {@code length} bytes on the source stream. This method should not * be used to skip bytes at any arbitrary position, just when reading * primitive data types (int, char etc). * * @param length * the number of bytes to skip. * @return the number of bytes actually skipped. * @throws IOException * if an error occurs while skipping bytes on the source stream. * @throws NullPointerException * if the source stream is {@code null}. */ public int skipBytes(int length) throws IOException { // To be used with available. Ok to call if reading primitive buffer if (input == null) { throw new NullPointerException("source stream is null"); } int offset = 0; while (offset < length) { checkReadPrimitiveTypes(); long skipped = primitiveData.skip(length - offset); if (skipped == 0) { return offset; } offset += (int) skipped; } return length; }
checkReadPrimitiveTypes(); if (primitiveData.available() > 0) { OptionalDataException e = new OptionalDataException();
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
@Override public int available() throws IOException { // returns 0 if next data is an object, or N if reading primitive types checkReadPrimitiveTypes(); return primitiveData.available(); }
/** * Reads a single byte from the source stream and returns it as an integer * in the range from 0 to 255. Returns -1 if the end of the source stream * has been reached. Blocks if no input is available. * * @return the byte read or -1 if the end of the source stream has been * reached. * @throws IOException if an error occurs while reading from this stream. */ @Override public int read() throws IOException { checkReadPrimitiveTypes(); return primitiveData.read(); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { JTranscArrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); if (byteCount == 0) { return 0; } checkReadPrimitiveTypes(); return primitiveData.read(buffer, byteOffset, byteCount); }