/** * Close the Reader * * @exception IOException on error. */ @Override public void close() throws IOException { if (master.getFD() == -1) return; int status = close0(master.getFD()); if (status == -1) throw new IOException("close error"); // $NON-NLS-1$ master.setFD(-1); }
/** @see OutputStream#write(byte[], int, int) */ @Override public void write(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } byte[] tmpBuf = new byte[len]; System.arraycopy(b, off, tmpBuf, off, len); write0(master.getFD(), tmpBuf, len); }