org.apache.cxf.io
Class CachedOutputStream
java.lang.Object
java.io.OutputStream
org.apache.cxf.io.CachedOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class CachedOutputStream
- extends java.io.OutputStream
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
currentStream
protected java.io.OutputStream currentStream
CachedOutputStream
public CachedOutputStream(java.io.PipedInputStream stream)
throws java.io.IOException
- Throws:
java.io.IOException
CachedOutputStream
public CachedOutputStream()
CachedOutputStream
public CachedOutputStream(long threshold)
registerCallback
public void registerCallback(CachedOutputStreamCallback cb)
deregisterCallback
public void deregisterCallback(CachedOutputStreamCallback cb)
getCallbacks
public java.util.List<CachedOutputStreamCallback> getCallbacks()
doFlush
protected void doFlush()
throws java.io.IOException
- Perform any actions required on stream flush (freeze headers, reset
output stream ... etc.)
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush
in interface java.io.Flushable
- Overrides:
flush
in class java.io.OutputStream
- Throws:
java.io.IOException
doClose
protected void doClose()
throws java.io.IOException
- Perform any actions required on stream closure (handle response etc.)
- Throws:
java.io.IOException
postClose
protected void postClose()
throws java.io.IOException
- Perform any actions required after stream closure (close the other related stream etc.)
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.OutputStream
- Throws:
java.io.IOException
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
resetOut
public void resetOut(java.io.OutputStream out,
boolean copyOldContent)
throws java.io.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 streamcopyOldContent
- flag indicating if the old content should be copied
- Throws:
java.io.IOException
copyStream
public static void copyStream(java.io.InputStream in,
java.io.OutputStream out,
int bufferSize)
throws java.io.IOException
- Throws:
java.io.IOException
size
public int size()
getBytes
public byte[] getBytes()
throws java.io.IOException
- Throws:
java.io.IOException
writeCacheTo
public void writeCacheTo(java.io.OutputStream out)
throws java.io.IOException
- Throws:
java.io.IOException
writeCacheTo
public void writeCacheTo(java.lang.StringBuilder out,
int limit)
throws java.io.IOException
- Throws:
java.io.IOException
writeCacheTo
public void writeCacheTo(java.lang.StringBuilder out)
throws java.io.IOException
- Throws:
java.io.IOException
getOut
public java.io.OutputStream getOut()
- Returns:
- the underlying output stream
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
onWrite
protected void onWrite()
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(int b)
throws java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
getTempFile
public java.io.File getTempFile()
getInputStream
public java.io.InputStream getInputStream()
throws java.io.IOException
- Throws:
java.io.IOException
dispose
public void dispose()
setOutputDir
public void setOutputDir(java.io.File outputDir)
throws java.io.IOException
- Throws:
java.io.IOException
setThreshold
public void setThreshold(long threshold)
Apache CXF is an effort undergoing incubation at the Apache Software Foundation(ASF) and sponsored by the Apache Incubator PMC.