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
 
 public class CachedWriter extends Writer 
- 
- 
Field SummaryFields Modifier and Type Field Description protected WritercurrentStreamprotected booleanoutputLocked
 - 
Constructor SummaryConstructors Constructor Description CachedWriter()CachedWriter(long threshold)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidderegisterCallback(CachedWriterCallback cb)protected 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 ...booleanequals(Object obj)voidflush()List<CachedWriterCallback>getCallbacks()char[]getChars()WritergetOut()ReadergetReader()FilegetTempFile()inthashCode()voidholdTempFile()voidlockOutputStream()Locks the output stream to prevent additional writes, but maintains a pointer to it so an InputStream can be obtainedprotected voidonWrite()protected voidpostClose()Perform any actions required after stream closure (close the other related stream etc.)voidregisterCallback(CachedWriterCallback cb)voidreleaseTempFileHold()voidresetOut(Writer 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 voidsetDefaultCipherTransformation(String n)static voidsetDefaultMaxSize(long l)static voidsetDefaultThreshold(int i)voidsetMaxSize(long maxSize)voidsetOutputDir(File outputDir)voidsetThreshold(long threshold)longsize()StringtoString()voidwrite(char[] cbuf, int off, int len)voidwriteCacheTo(Writer out)voidwriteCacheTo(StringBuilder out)voidwriteCacheTo(StringBuilder out, long limit)
 
- 
- 
- 
Field Detail- 
outputLockedprotected boolean outputLocked 
 - 
currentStreamprotected Writer currentStream 
 
- 
 - 
Method Detail- 
holdTempFilepublic void holdTempFile() 
 - 
releaseTempFileHoldpublic void releaseTempFileHold() 
 - 
registerCallbackpublic void registerCallback(CachedWriterCallback cb) 
 - 
deregisterCallbackpublic void deregisterCallback(CachedWriterCallback cb) 
 - 
getCallbackspublic List<CachedWriterCallback> getCallbacks() 
 - 
doFlushprotected void doFlush() throws IOExceptionPerform any actions required on stream flush (freeze headers, reset output stream ... etc.)- Throws:
- IOException
 
 - 
flushpublic void flush() throws IOException- Specified by:
- flushin interface- Flushable
- Specified by:
- flushin class- Writer
- Throws:
- IOException
 
 - 
doCloseprotected void doClose() throws IOExceptionPerform any actions required on stream closure (handle response etc.)- Throws:
- IOException
 
 - 
postCloseprotected void postClose() throws IOExceptionPerform any actions required after stream closure (close the other related stream etc.)- Throws:
- IOException
 
 - 
lockOutputStreampublic void lockOutputStream() throws IOExceptionLocks the output stream to prevent additional writes, but maintains a pointer to it so an InputStream can be obtained- Throws:
- IOException
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein class- Writer
- Throws:
- IOException
 
 - 
resetOutpublic void resetOut(Writer out, boolean copyOldContent) throws IOException 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 stream
- copyOldContent- flag indicating if the old content should be copied
- Throws:
- IOException
 
 - 
sizepublic long size() 
 - 
getCharspublic char[] getChars() throws IOException- Throws:
- IOException
 
 - 
writeCacheTopublic void writeCacheTo(Writer out) throws IOException - Throws:
- IOException
 
 - 
writeCacheTopublic void writeCacheTo(StringBuilder out, long limit) throws IOException - Throws:
- IOException
 
 - 
writeCacheTopublic void writeCacheTo(StringBuilder out) throws IOException - Throws:
- IOException
 
 - 
getOutpublic Writer getOut() - Returns:
- the underlying output stream
 
 - 
onWriteprotected void onWrite() throws IOException- Throws:
- IOException
 
 - 
writepublic void write(char[] cbuf, int off, int len) throws IOException- Specified by:
- writein class- Writer
- Throws:
- IOException
 
 - 
getTempFilepublic File getTempFile() 
 - 
getReaderpublic Reader getReader() throws IOException - Throws:
- IOException
 
 - 
setOutputDirpublic void setOutputDir(File outputDir) throws IOException - Throws:
- IOException
 
 - 
setThresholdpublic void setThreshold(long threshold) 
 - 
setMaxSizepublic void setMaxSize(long maxSize) 
 - 
setCipherTransformationpublic void setCipherTransformation(String cipherTransformation) 
 - 
setDefaultMaxSizepublic static void setDefaultMaxSize(long l) 
 - 
setDefaultThresholdpublic static void setDefaultThreshold(int i) 
 - 
setDefaultCipherTransformationpublic static void setDefaultCipherTransformation(String n) 
 
- 
 
-