/** * Reads the bytes to the buffer. This method will try to read as many bytes as the buffer can hold. * * @param b the destination buffer * @return the number of bytes actually read * @throws java.io.IOException in */ public int read(byte b[]) throws java.io.IOException { return read(b, 0, b.length); }
/** * {@inheritDoc} */ public void readFully(byte[] b, int off, int len) throws java.io.IOException { int n = 0; do { int count = read(b, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } while (n < len); }
/** * {@inheritDoc} */ public int readUnsignedByte() throws java.io.IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return ch; }
/** * {@inheritDoc} */ public void readFully(byte[] b, int off, int len) throws java.io.IOException { int n = 0; do { int count = read(b, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } while (n < len); }
/** * {@inheritDoc} */ public boolean readBoolean() throws java.io.IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (ch != 0); }
public static void transferBytes(RandomAccessFileOrArray input, java.io.OutputStream output) throws java.io.IOException { byte[] buffer = new byte[TRANSFER_SIZE]; for (; ; ) { int len = input.read(buffer, 0, TRANSFER_SIZE); if (len > 0) { output.write(buffer, 0, len); } else { break; } } }
/** * {@inheritDoc} */ public byte readByte() throws java.io.IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (byte) (ch); }
/** * {@inheritDoc} */ public byte readByte() throws java.io.IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return (byte) (ch); }
/** * {@inheritDoc} */ public int readUnsignedByte() throws java.io.IOException { int ch = this.read(); if (ch < 0) throw new EOFException(); return ch; }
public static void transferBytes(RandomAccessFileOrArray input, java.io.OutputStream output) throws java.io.IOException { byte[] buffer = new byte[TRANSFER_SIZE]; for (; ; ) { int len = input.read(buffer, 0, TRANSFER_SIZE); if (len > 0) { output.write(buffer, 0, len); } else { break; } } }
private String readString() throws java.io.IOException { StringBuilder buf = new StringBuilder(); while (true) { int c = input.read(); if (c <= 0) break; buf.append((char)c); } return buf.toString(); }
private String readString() throws java.io.IOException { StringBuilder buf = new StringBuilder(); while (true) { int c = input.read(); if (c <= 0) break; buf.append((char)c); } return buf.toString(); }