Package org.apache.camel.support.builder
Class OutputStreamBuilder
java.lang.Object
java.io.OutputStream
org.apache.camel.support.builder.OutputStreamBuilder
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Utility to hide the complexity of choosing which OutputStream implementation to choose.
Itself masquerades as an OutputStream, but really delegates to a CachedOutputStream or a ByteArrayOutputStream.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the result of using this builder as either aCachedOutputStreamif stream caching is enabled, otherwise byte[].voidclose()voidflush()static OutputStreamBuilderwithExchange(org.apache.camel.Exchange exchange) Creates a new OutputStreamBuilder with the current exchangevoidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Method Details
-
withExchange
Creates a new OutputStreamBuilder with the current exchange Use thebuild()when writing to the stream is finished, and you need the result of this operation.- Parameters:
exchange- the current Exchange- Returns:
- the builder
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
build
Builds the result of using this builder as either aCachedOutputStreamif stream caching is enabled, otherwise byte[].- Throws:
IOException
-