@Override public int fill(ByteBuffer buffer) throws IOException { return _endp.fill(buffer); }
public int fill(ByteBuffer buffer) throws IOException { return _endp.fill(buffer); }
/** * <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p> * * @param endPoint the endPoint to read from * @param buffer the buffer to read data into * @param context the context information related to the connection * @return the number of bytes read (possibly 0 since the read is non-blocking) * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException { return endPoint.fill(buffer); }
/** * <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p> * * @param endPoint the endPoint to read from * @param buffer the buffer to read data into * @param context the context information related to the connection * @return the number of bytes read (possibly 0 since the read is non-blocking) * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException { return endPoint.fill(buffer); }
/** * <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p> * * @param endPoint the endPoint to read from * @param buffer the buffer to read data into * @param context the context information related to the connection * @return the number of bytes read (possibly 0 since the read is non-blocking) * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException { return endPoint.fill(buffer); }
/** * <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p> * * @param endPoint the endPoint to read from * @param buffer the buffer to read data into * @param context the context information related to the connection * @return the number of bytes read (possibly 0 since the read is non-blocking) * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException { return endPoint.fill(buffer); }
/** * <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p> * * @param endPoint the endPoint to read from * @param buffer the buffer to read data into * @param context the context information related to the connection * @return the number of bytes read (possibly 0 since the read is non-blocking) * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException { return endPoint.fill(buffer); }
@Override public synchronized int fill(final ByteBuffer dst) throws IOException { if (_marked) { final int oldLimit = dst.limit(); final int i = _underlying.fill(dst); int newLimit = dst.limit(); ByteBuffer buf = preserve(dst.duplicate(), newLimit, oldLimit); _preserved.add(buf); return i; } else { int i = 0; if (!_preserved.isEmpty()) { i += fillFromPreserved(dst); if (!_preserved.isEmpty()) { return i; } } i += _underlying.fill(dst); return i; } }
/** * <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p> * * @param endPoint the endPoint to read from * @param buffer the buffer to read data into * @param context the context information related to the connection * @return the number of bytes read (possibly 0 since the read is non-blocking) * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ protected int read(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap<String, Object> context) throws IOException { int read = endPoint.fill(buffer); if (LOG.isDebugEnabled()) LOG.debug("{} read {} bytes", this, read); return read; }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill() { try { return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { LOG.debug(x); close(); return -1; } }
private int fill(EndPoint endPoint, ByteBuffer buffer) { try { if (endPoint.isInputShutdown()) return -1; return endPoint.fill(buffer); } catch (IOException x) { endPoint.close(); throw new RuntimeIOException(x); } }
private int fill(EndPoint endPoint, ByteBuffer buffer) { try { if (endPoint.isInputShutdown()) return -1; return endPoint.fill(buffer); } catch (IOException x) { if (LOG.isDebugEnabled()) LOG.debug("Could not read from " + endPoint, x); return -1; } }
private int fill(EndPoint endPoint, ByteBuffer buffer) { try { if (endPoint.isInputShutdown()) return -1; return endPoint.fill(buffer); } catch (IOException x) { if (LOG.isDebugEnabled()) LOG.debug("Could not read from " + endPoint, x); return -1; } }
@Override public void onFillable() { try { while (true) { // Avoid to read too much from the socket: ask // the parser how much left there is to read. ByteBuffer buffer = BufferUtil.allocate(parser.expected()); int filled = getEndPoint().fill(buffer); if (LOG.isDebugEnabled()) LOG.debug("Read SOCKS4 connect response, {} bytes", filled); if (filled < 0) throw new IOException("SOCKS4 tunnel failed, connection closed"); if (filled == 0) { fillInterested(); return; } if (parser.parse(buffer)) return; } } catch (Throwable x) { failed(x); } }