Package org.apache.cxf.io
Class CachedWriter
java.lang.Object
java.io.Writer
org.apache.cxf.io.CachedWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
XSLTOutInterceptor.XSLTCachedWriter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 ...booleanvoidflush()char[]getChars()getOut()inthashCode()voidvoidLocks 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.)voidvoidvoidReplace 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(char[] cbuf, int off, int len) voidwriteCacheTo(Writer out) voidvoidwriteCacheTo(StringBuilder out, long limit)
-
Field Details
-
outputLocked
protected boolean outputLocked -
currentStream
-
-
Constructor Details
-
CachedWriter
public CachedWriter() -
CachedWriter
public CachedWriter(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- Specified by:
flushin classWriter- 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- Specified by:
closein classWriter- 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
-
size
public long size() -
getChars
- 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
- Specified by:
writein classWriter- Throws:
IOException
-
getTempFile
-
getReader
- Throws:
IOException
-
setOutputDir
- Throws:
IOException
-
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) -
setDefaultCipherTransformation
-