Package com.atlassian.jira.util
Class Base64InputStreamConsumer
java.lang.Object
com.atlassian.jira.util.Base64InputStreamConsumer
- All Implemented Interfaces:
Consumer<InputStream>
Basic slurp implementation of an InputStream Consumer which provides Base64 encoded output.
Note that this reads the whole input into memory and should not be used for data that may grow big.
- Since:
- v4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconsume(InputStream element) Consume the product.Gives the Base64 encoded String only if the consume method ran without exception.
-
Constructor Details
-
Base64InputStreamConsumer
public Base64InputStreamConsumer(boolean chunked) Creates this encoder. Set chunked to true if you want a 72 character formatted ("chunked") String or false if you don't need formatting.- Parameters:
chunked- whether you want a chunked Base64 encoded output.
-
-
Method Details
-
consume
Description copied from interface:ConsumerConsume the product.- Specified by:
consumein interfaceConsumer<InputStream>- Parameters:
element- must not be null
-
getEncoded
Gives the Base64 encoded String only if the consume method ran without exception. Otherwise returns the empty String.- Returns:
- the empty String or the base64 encoded content of the InputStream.
-