Class RequestLoggerInputStream
- java.lang.Object
-
- java.io.InputStream
-
- hu.icellmobilsoft.coffee.tool.utils.stream.RequestLoggerInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class RequestLoggerInputStream extends InputStream
CustomInputStreamfor logging request with entity- Since:
- 2.4.0
- Author:
- mate.biro
-
-
Constructor Summary
Constructors Constructor Description RequestLoggerInputStream(InputStream requestEntityStream, int logCollectLimit, String requestPrefix, StringBuilder logMessage)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intread()
Extra functionality: On read the request entity data is appended from the originalInputStreamto an internalStringBuilderuntil a given limit is reached (or until the end of stream if log limit exceeds the length of the stream).-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
RequestLoggerInputStream
public RequestLoggerInputStream(InputStream requestEntityStream, int logCollectLimit, String requestPrefix, StringBuilder logMessage)
Constructor- Parameters:
requestEntityStream- original requestEntityStreamlogCollectLimit- read limitrequestPrefix- request log prefixlogMessage- log message
-
-
Method Detail
-
read
public int read() throws IOException
Extra functionality: On read the request entity data is appended from the originalInputStreamto an internalStringBuilderuntil a given limit is reached (or until the end of stream if log limit exceeds the length of the stream). Then publishes an event to log the given request message with the appended request entity.- Specified by:
readin classInputStream- Throws:
IOException
-
-