Package org.apache.cxf.io
Class CachedOutputStream
java.lang.Object
java.io.OutputStream
org.apache.cxf.io.CachedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
CacheAndWriteOutputStream,WriteOnCloseOutputStream
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static voidcopyStream(InputStream in, OutputStream out, int bufferSize) voidprotected voiddoClose()Perform any actions required on stream closure (handle response etc.)protected voiddoFlush()Perform any actions required on stream flush (freeze headers, reset output stream ... etc.)booleanvoidflush()byte[]getBytes()getOut()longinthashCode()voidstatic booleanReturns true if the default threshold is explicitly set via CachedConstants.THRESHOLD_SYS_PROPvoidLocks the output stream to prevent additional writes, but maintains a pointer to it so an InputStream can be obtainedprotected voidonWrite()protected voidPerform any actions required after stream closure (close the other related stream etc.)voidvoidvoidresetOut(OutputStream out, boolean copyOldContent) Replace the original stream with the new one, optionally copying the content of the old one into the new one.voidsetCipherTransformation(String cipherTransformation) static voidstatic voidsetDefaultMaxSize(long l) static voidsetDefaultThreshold(int i) voidsetMaxSize(long maxSize) voidsetOutputDir(File outputDir) voidsetThreshold(long threshold) longsize()toString()voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) voidwriteCacheTo(OutputStream out) voidvoidwriteCacheTo(StringBuilder out, long limit) voidwriteCacheTo(StringBuilder out, String charsetName) voidwriteCacheTo(StringBuilder out, String charsetName, long limit) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
outputLocked
protected boolean outputLocked -
currentStream
-
-
Constructor Details
-
CachedOutputStream
public CachedOutputStream() -
CachedOutputStream
public CachedOutputStream(long threshold)
-
-
Method Details
-
holdTempFile
public void holdTempFile() -
releaseTempFileHold
public void releaseTempFileHold() -
registerCallback
-
deregisterCallback
-
getCallbacks
-
doFlush
Perform any actions required on stream flush (freeze headers, reset output stream ... etc.)- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
doClose
Perform any actions required on stream closure (handle response etc.)- Throws:
IOException
-
postClose
Perform any actions required after stream closure (close the other related stream etc.)- Throws:
IOException
-
lockOutputStream
Locks the output stream to prevent additional writes, but maintains a pointer to it so an InputStream can be obtained- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
equals
-
resetOut
Replace the original stream with the new one, optionally copying the content of the old one into the new one. When with Attachment, needs to replace the xml writer stream with the stream used by AttachmentSerializer or copy the cached output stream to the "real" output stream, i.e. onto the wire.- Parameters:
out- the new output streamcopyOldContent- flag indicating if the old content should be copied- Throws:
IOException
-
copyStream
- Throws:
IOException
-
size
public long size() -
getBytes
- Throws:
IOException
-
writeCacheTo
- Throws:
IOException
-
writeCacheTo
- Throws:
IOException
-
writeCacheTo
- Throws:
IOException
-
writeCacheTo
- Throws:
IOException
-
writeCacheTo
- Throws:
IOException
-
getOut
- Returns:
- the underlying output stream
-
hashCode
public int hashCode() -
toString
-
onWrite
- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
getTempFile
-
getInputStream
- Throws:
IOException
-
setOutputDir
- Throws:
IOException
-
getThreshold
public long getThreshold() -
setThreshold
public void setThreshold(long threshold) -
setMaxSize
public void setMaxSize(long maxSize) -
setCipherTransformation
-
setDefaultMaxSize
public static void setDefaultMaxSize(long l) -
setDefaultThreshold
public static void setDefaultThreshold(int i) -
isThresholdSysPropSet
public static boolean isThresholdSysPropSet()Returns true if the default threshold is explicitly set via CachedConstants.THRESHOLD_SYS_PROP -
setDefaultCipherTransformation
-