@Override public void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); try (final InputStream inStream = getContent()) { if (inStream != null) { int count; final byte[] tmp = new byte[OUTPUT_BUFFER_SIZE]; while ((count = inStream.read(tmp)) != -1) { outStream.write(tmp, 0, count); } } } }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); sb.append("Content-Type: "); sb.append(getContentType()); sb.append(','); sb.append("Content-Encoding: "); sb.append(getContentEncoding()); sb.append(','); final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(isChunked()); sb.append(']'); return sb.toString(); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); sb.append("Content-Type: "); sb.append(getContentType()); sb.append(','); sb.append("Content-Encoding: "); sb.append(getContentEncoding()); sb.append(','); final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(isChunked()); sb.append(']'); return sb.toString(); }
@Override public void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); try (final InputStream inStream = getContent()) { if (inStream != null) { int count; final byte[] tmp = new byte[OUTPUT_BUFFER_SIZE]; while ((count = inStream.read(tmp)) != -1) { outStream.write(tmp, 0, count); } } } }