/** * <p>Does not close the underlying socket output.</p> * * @throws IOException If an I/O problem occurs. */ public void close() throws IOException { if (!this.closed) { this.closed = true; this.out.flush(); } }
/** * Writes the cache out onto the underlying stream * @throws IOException */ protected void flushCache() throws IOException { if (this.cachePosition > 0) { this.out.writeLine(Integer.toHexString(this.cachePosition)); this.out.write(this.cache, 0, this.cachePosition); this.out.writeLine(""); this.cachePosition = 0; } }
public HttpTransportMetrics getMetrics() { return this.out.getMetrics(); }
public void write(int b) throws IOException { if (this.closed) { throw new IOException("Attempted write to closed stream."); } this.out.write(b); }
public void write(int b) throws IOException { if (this.closed) { throw new IOException("Attempted write to closed stream."); } if (this.total < this.contentLength) { this.out.write(b); this.total++; } }
protected void writeHeadLine(final HttpMessage message) throws IOException { final CharArrayBuffer buffer = lineFormatter.formatRequestLine (this.lineBuf, ((HttpRequest) message).getRequestLine()); this.sessionBuffer.writeLine(buffer); }
/** * Writes the cache and bufferToAppend to the underlying stream * as one large chunk * @param bufferToAppend * @param off * @param len * @throws IOException */ protected void flushCacheWithAppend(byte bufferToAppend[], int off, int len) throws IOException { this.out.writeLine(Integer.toHexString(this.cachePosition + len)); this.out.write(this.cache, 0, this.cachePosition); this.out.write(bufferToAppend, off, len); this.out.writeLine(""); this.cachePosition = 0; }
/** * <p>Does not close the underlying socket output.</p> * * @throws IOException If an I/O problem occurs. */ public void close() throws IOException { if (!this.closed) { this.closed = true; this.out.flush(); } }
public void write(byte[] b, int off, int len) throws IOException { if (this.closed) { throw new IOException("Attempted write to closed stream."); } this.out.write(b, off, len); }
protected void writeHeadLine(final HttpMessage message) throws IOException { final CharArrayBuffer buffer = lineFormatter.formatStatusLine (this.lineBuf, ((HttpResponse) message).getStatusLine()); this.sessionBuffer.writeLine(buffer); }
protected void init( final SessionInputBuffer inbuffer, final SessionOutputBuffer outbuffer, final HttpParams params) { if (inbuffer == null) { throw new IllegalArgumentException("Input session buffer may not be null"); } if (outbuffer == null) { throw new IllegalArgumentException("Output session buffer may not be null"); } this.inbuffer = inbuffer; this.outbuffer = outbuffer; this.requestParser = createRequestParser( inbuffer, createHttpRequestFactory(), params); this.responseWriter = createResponseWriter( outbuffer, params); this.metrics = new HttpConnectionMetricsImpl( inbuffer.getMetrics(), outbuffer.getMetrics()); }
/** * Writes the cache and bufferToAppend to the underlying stream * as one large chunk */ protected void flushCacheWithAppend(final byte bufferToAppend[], final int off, final int len) throws IOException { this.out.writeLine(Integer.toHexString(this.cachePosition + len)); this.out.write(this.cache, 0, this.cachePosition); this.out.write(bufferToAppend, off, len); this.out.writeLine(""); this.cachePosition = 0; }
public void flush() throws IOException { this.out.flush(); }
public void write(byte[] b, int off, int len) throws IOException { if (this.closed) { throw new IOException("Attempted write to closed stream."); } if (this.total < this.contentLength) { long max = this.contentLength - this.total; if (len > max) { len = (int) max; } this.out.write(b, off, len); this.total += len; } }
public void write( final HttpMessage message) throws IOException, HttpException { if (message == null) { throw new IllegalArgumentException("HTTP message may not be null"); } writeHeadLine(message); for (Iterator it = message.headerIterator(); it.hasNext(); ) { Header header = (Header) it.next(); this.sessionBuffer.writeLine (lineFormatter.formatHeader(this.lineBuf, header)); } this.lineBuf.clear(); this.sessionBuffer.writeLine(this.lineBuf); }
protected void init( final SessionInputBuffer inbuffer, final SessionOutputBuffer outbuffer, final HttpParams params) { if (inbuffer == null) { throw new IllegalArgumentException("Input session buffer may not be null"); } if (outbuffer == null) { throw new IllegalArgumentException("Output session buffer may not be null"); } this.inbuffer = inbuffer; this.outbuffer = outbuffer; this.responseParser = createResponseParser( inbuffer, createHttpResponseFactory(), params); this.requestWriter = createRequestWriter( outbuffer, params); this.metrics = new HttpConnectionMetricsImpl( inbuffer.getMetrics(), outbuffer.getMetrics()); }
/** * Writes the cache and bufferToAppend to the underlying stream * as one large chunk */ protected void flushCacheWithAppend(final byte bufferToAppend[], final int off, final int len) throws IOException { this.out.writeLine(Integer.toHexString(this.cachePosition + len)); this.out.write(this.cache, 0, this.cachePosition); this.out.write(bufferToAppend, off, len); this.out.writeLine(""); this.cachePosition = 0; }
protected void doFlush() throws IOException { this.outbuffer.flush(); }
public void write(byte[] b) throws IOException { this.out.write(b); if (this.wire.enabled()) { this.wire.output(b); } }