Class ResponseEntityCollectorOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- hu.icellmobilsoft.coffee.tool.utils.stream.ResponseEntityCollectorOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class ResponseEntityCollectorOutputStream extends OutputStream
CustomOutputStreamfor collecting response entity- Since:
- 2.4.0
- Author:
- mate.biro
-
-
Constructor Summary
Constructors Constructor Description ResponseEntityCollectorOutputStream(OutputStream originalResponseStream, int logCollectLimit)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getEntity()Returns the entity as byte arrayvoidwrite(int b)
Extra functionality: It appends the response entity data written to the originalOutputStreamto an internalStringBuilderuntil the given limit has been reached.-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write, write
-
-
-
-
Constructor Detail
-
ResponseEntityCollectorOutputStream
public ResponseEntityCollectorOutputStream(OutputStream originalResponseStream, int logCollectLimit)
Constructor- Parameters:
originalResponseStream- the original intercepted output streamlogCollectLimit- collect limit
-
-
Method Detail
-
write
public void write(int b) throws IOException
Extra functionality: It appends the response entity data written to the originalOutputStreamto an internalStringBuilderuntil the given limit has been reached.- Specified by:
writein classOutputStream- Throws:
IOException
-
getEntity
public byte[] getEntity()
Returns the entity as byte array- Returns:
- Entity byte array
-
-