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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
protected void
doClose()
Perform any actions required on stream closure (handle response etc.)protected void
doFlush()
Perform any actions required on stream flush (freeze headers, reset output stream ...boolean
void
flush()
char[]
getChars()
getOut()
int
hashCode()
void
void
Locks the output stream to prevent additional writes, but maintains a pointer to it so an InputStream can be obtainedprotected void
onWrite()
protected void
Perform any actions required after stream closure (close the other related stream etc.)void
void
void
Replace the original stream with the new one, optionally copying the content of the old one into the new one.void
setCipherTransformation
(String cipherTransformation) static void
static void
setDefaultMaxSize
(long l) static void
setDefaultThreshold
(int i) void
setMaxSize
(long maxSize) void
setOutputDir
(File outputDir) void
setThreshold
(long threshold) long
size()
toString()
void
write
(char[] cbuf, int off, int len) void
writeCacheTo
(Writer out) void
void
writeCacheTo
(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:
flush
in interfaceFlushable
- Specified by:
flush
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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:
write
in 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
-