Package org.apache.commons.httpclient
Class ChunkedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.httpclient.ChunkedOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
@Deprecated public class ChunkedOutputStream extends java.io.OutputStreamDeprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.Implements HTTP chunking support. Writes are buffered to an internal buffer (2048 default size). Chunks are guaranteed to be at least as large as the buffer size (except for the last chunk).
-
-
Constructor Summary
Constructors Constructor Description ChunkedOutputStream(java.io.OutputStream stream)Deprecated.Wraps a stream and chunks the output.ChunkedOutputStream(java.io.OutputStream stream, int bufferSize)Deprecated.Wraps a stream and chunks the output.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.Finishes writing to the underlying stream, but does NOT close the underlying stream.voidfinish()Deprecated.Must be called to ensure the internal cache is flushed and the closing chunk is written.voidflush()Deprecated.Flushes the underlying stream, but leaves the internal buffer alone.voidwrite(byte[] b)Deprecated.Writes the array.voidwrite(byte[] src, int off, int len)Deprecated.voidwrite(int b)Deprecated.Write the specified byte to our output stream.
-
-
-
Constructor Detail
-
ChunkedOutputStream
public ChunkedOutputStream(java.io.OutputStream stream, int bufferSize) throws java.io.IOExceptionDeprecated.Wraps a stream and chunks the output.- Parameters:
stream- to wrapbufferSize- minimum chunk size (excluding last chunk)- Throws:
java.io.IOException- Since:
- 3.0
-
ChunkedOutputStream
public ChunkedOutputStream(java.io.OutputStream stream) throws java.io.IOExceptionDeprecated.Wraps a stream and chunks the output. The default buffer size of 2048 was chosen because the chunk overhead is less than 0.5%- Parameters:
stream-- Throws:
java.io.IOException
-
-
Method Detail
-
finish
public void finish() throws java.io.IOExceptionDeprecated.Must be called to ensure the internal cache is flushed and the closing chunk is written.- Throws:
java.io.IOException- Since:
- 3.0
-
write
public void write(int b) throws java.io.IOExceptionDeprecated.Write the specified byte to our output stream. Note: Avoid this method as it will cause an inefficient single byte chunk. Use write (byte[], int, int) instead.- Specified by:
writein classjava.io.OutputStream- Parameters:
b- The byte to be written- Throws:
java.io.IOException- if an input/output error occurs
-
write
public void write(byte[] b) throws java.io.IOExceptionDeprecated.Writes the array. If the array does not fit within the buffer, it is not split, but rather written out as one large chunk.- Overrides:
writein classjava.io.OutputStream- Parameters:
b-- Throws:
java.io.IOException- Since:
- 3.0
-
write
public void write(byte[] src, int off, int len) throws java.io.IOExceptionDeprecated.- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionDeprecated.Flushes the underlying stream, but leaves the internal buffer alone.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionDeprecated.Finishes writing to the underlying stream, but does NOT close the underlying stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
-