@Override protected void fill() throws IOException { receiveCounter++; super.fill(); } };
@Override public int read(byte[] b, int off, int len) throws IOException { receiveCounter++; return super.read(b, off, len); } @Override
@Override public int read(byte b[], int off, int len) throws IOException { if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int n = 0; for (;;) { int nread = readStream(b, off + n, len - n); if (nread <= 0) { return (n == 0) ? nread : n; } n += nread; if (n >= len) { return n; } // if not closed but no bytes available, return InputStream input = in; if (input != null && input.available() <= 0) { return n; } } }
@Override public long skip(long n) throws IOException { receiveCounter++; return super.skip(n); } @Override
buffIn.unread(initBuffer.buffer.array());
"org.jabber.etherx.streams"); inputStream = new TcpBufferedInputStream(socket.getInputStream(), 8 * 1024); outputStream = new TcpBufferedOutputStream(socket.getOutputStream(), 16 * 1024);
@Override public long skip(long n) throws IOException { receiveCounter++; return super.skip(n); } @Override
buffIn.unread(initBuffer.buffer.array());
@Override public int read() throws IOException { if (position >= count) { fill(); if (position >= count) { return -1; } } return internalBuffer[position++] & 0xff; }
@Override public int read() throws IOException { receiveCounter++; return super.read(); } @Override
@Override public long skip(long n) throws IOException { receiveCounter++; return super.skip(n); } @Override
@Override public int read(byte b[], int off, int len) throws IOException { if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int n = 0; for (;;) { int nread = readStream(b, off + n, len - n); if (nread <= 0) { return (n == 0) ? nread : n; } n += nread; if (n >= len) { return n; } // if not closed but no bytes available, return InputStream input = in; if (input != null && input.available() <= 0) { return n; } } }
buffIn.unread(initBuffer.buffer.array());
private int readStream(byte[] b, int off, int len) throws IOException { int avail = count - position; if (avail <= 0) { if (len >= internalBuffer.length) { return in.read(b, off, len); } fill(); avail = count - position; if (avail <= 0) { return -1; } } int cnt = (avail < len) ? avail : len; System.arraycopy(internalBuffer, position, b, off, cnt); position += cnt; return cnt; }
@Override public int read(byte[] b, int off, int len) throws IOException { receiveCounter++; return super.read(b, off, len); } @Override
@Override public long skip(long n) throws IOException { receiveCounter++; return super.skip(n); } @Override
@Override public int read(byte b[], int off, int len) throws IOException { if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int n = 0; for (;;) { int nread = readStream(b, off + n, len - n); if (nread <= 0) { return (n == 0) ? nread : n; } n += nread; if (n >= len) { return n; } // if not closed but no bytes available, return InputStream input = in; if (input != null && input.available() <= 0) { return n; } } }
buffIn.unread(initBuffer.buffer.array());
@Override protected void fill() throws IOException { receiveCounter++; super.fill(); } };
@Override public int read() throws IOException { receiveCounter++; return super.read(); } @Override