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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static void
copyStream
(InputStream in, OutputStream out, int bufferSize) 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()
byte[]
getBytes()
getOut()
long
int
hashCode()
void
static boolean
Returns true if the default threshold is explicitly set via CachedConstants.THRESHOLD_SYS_PROPvoid
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
resetOut
(OutputStream out, boolean copyOldContent) 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
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) void
writeCacheTo
(OutputStream out) void
void
writeCacheTo
(StringBuilder out, long limit) void
writeCacheTo
(StringBuilder out, String charsetName) void
writeCacheTo
(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:
flush
in interfaceFlushable
- Overrides:
flush
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in 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
-