public class CachedOutputStream
extends java.io.OutputStream
| Modifier and Type | Field and Description |
|---|---|
protected java.io.OutputStream |
currentStream |
protected boolean |
outputLocked |
| Constructor and Description |
|---|
CachedOutputStream() |
CachedOutputStream(long threshold) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out,
int bufferSize) |
void |
deregisterCallback(CachedOutputStreamCallback cb) |
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 |
equals(java.lang.Object obj) |
void |
flush() |
byte[] |
getBytes() |
java.util.List<CachedOutputStreamCallback> |
getCallbacks() |
java.io.InputStream |
getInputStream() |
java.io.OutputStream |
getOut() |
java.io.File |
getTempFile() |
long |
getThreshold() |
int |
hashCode() |
void |
holdTempFile() |
static boolean |
isThresholdSysPropSet()
Returns true if the default threshold is explicitly set via CachedConstants.THRESHOLD_SYS_PROP
|
void |
lockOutputStream()
Locks the output stream to prevent additional writes, but maintains
a pointer to it so an InputStream can be obtained
|
protected void |
onWrite() |
protected void |
postClose()
Perform any actions required after stream closure (close the other related stream etc.)
|
void |
registerCallback(CachedOutputStreamCallback cb) |
void |
releaseTempFileHold() |
void |
resetOut(java.io.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(java.lang.String cipherTransformation) |
static void |
setDefaultCipherTransformation(java.lang.String n) |
static void |
setDefaultMaxSize(long l) |
static void |
setDefaultThreshold(int i) |
void |
setMaxSize(long maxSize) |
void |
setOutputDir(java.io.File outputDir) |
void |
setThreshold(long threshold) |
long |
size() |
java.lang.String |
toString() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeCacheTo(java.io.OutputStream out) |
void |
writeCacheTo(java.lang.StringBuilder out) |
void |
writeCacheTo(java.lang.StringBuilder out,
long limit) |
void |
writeCacheTo(java.lang.StringBuilder out,
java.lang.String charsetName) |
void |
writeCacheTo(java.lang.StringBuilder out,
java.lang.String charsetName,
long limit) |
protected boolean outputLocked
protected java.io.OutputStream currentStream
public CachedOutputStream()
public CachedOutputStream(long threshold)
public void holdTempFile()
public void releaseTempFileHold()
public void registerCallback(CachedOutputStreamCallback cb)
public void deregisterCallback(CachedOutputStreamCallback cb)
public java.util.List<CachedOutputStreamCallback> getCallbacks()
protected void doFlush()
throws java.io.IOException
java.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionprotected void doClose()
throws java.io.IOException
java.io.IOExceptionprotected void postClose()
throws java.io.IOException
java.io.IOExceptionpublic void lockOutputStream()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic void resetOut(java.io.OutputStream out,
boolean copyOldContent)
throws java.io.IOException
out - the new output streamcopyOldContent - flag indicating if the old content should be copiedjava.io.IOExceptionpublic static void copyStream(java.io.InputStream in,
java.io.OutputStream out,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic long size()
public byte[] getBytes()
throws java.io.IOException
java.io.IOExceptionpublic void writeCacheTo(java.io.OutputStream out)
throws java.io.IOException
java.io.IOExceptionpublic void writeCacheTo(java.lang.StringBuilder out,
long limit)
throws java.io.IOException
java.io.IOExceptionpublic void writeCacheTo(java.lang.StringBuilder out,
java.lang.String charsetName,
long limit)
throws java.io.IOException
java.io.IOExceptionpublic void writeCacheTo(java.lang.StringBuilder out)
throws java.io.IOException
java.io.IOExceptionpublic void writeCacheTo(java.lang.StringBuilder out,
java.lang.String charsetName)
throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream getOut()
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectprotected void onWrite()
throws java.io.IOException
java.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic java.io.File getTempFile()
public java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOExceptionpublic void setOutputDir(java.io.File outputDir)
throws java.io.IOException
java.io.IOExceptionpublic long getThreshold()
public void setThreshold(long threshold)
public void setMaxSize(long maxSize)
public void setCipherTransformation(java.lang.String cipherTransformation)
public static void setDefaultMaxSize(long l)
public static void setDefaultThreshold(int i)
public static boolean isThresholdSysPropSet()
public static void setDefaultCipherTransformation(java.lang.String n)