|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.apache.camel.converter.stream.CachedOutputStream
public class CachedOutputStream
This output stream will store the content into a File if the stream context size is exceed the THRESHOLD which's default value is 64K. The temp file will store in the temp directory, you can configure it by setting the TEMP_DIR property. If you don't set the TEMP_DIR property, it will choice the directory which is set by the system property of "java.io.tmpdir". You can get a cached input stream of this stream. The temp file which is created with this output stream will be deleted when you close this output stream or the cached inputStream.
| Field Summary | |
|---|---|
protected OutputStream |
currentStream
|
protected boolean |
outputLocked
|
static String |
TEMP_DIR
|
static String |
THRESHOLD
|
| Constructor Summary | |
|---|---|
CachedOutputStream()
|
|
CachedOutputStream(long threshold)
|
|
CachedOutputStream(Map<String,String> properties)
|
|
| Method Summary | |
|---|---|
void |
close()
|
static void |
copyStream(InputStream in,
OutputStream out,
int bufferSize)
|
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(Object obj)
|
void |
flush()
|
byte[] |
getBytes()
|
InputStream |
getInputStream()
|
OutputStream |
getOut()
|
StreamCache |
getStreamCache()
|
File |
getTempFile()
|
int |
hashCode()
|
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 |
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 |
setOutputDir(File outputDir)
|
void |
setThreshold(long threshold)
|
int |
size()
|
String |
toString()
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
void |
writeCacheTo(OutputStream out)
|
void |
writeCacheTo(StringBuilder out)
|
void |
writeCacheTo(StringBuilder out,
int limit)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String THRESHOLD
public static final String TEMP_DIR
protected boolean outputLocked
protected OutputStream currentStream
| Constructor Detail |
|---|
public CachedOutputStream()
public CachedOutputStream(long threshold)
public CachedOutputStream(Map<String,String> properties)
| Method Detail |
|---|
protected void doFlush()
throws IOException
IOException
public void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOException
protected void doClose()
throws IOException
IOException
protected void postClose()
throws IOException
IOException
public void lockOutputStream()
throws IOException
IOException
public void close()
throws IOException
close in interface Closeableclose in class OutputStreamIOExceptionpublic boolean equals(Object obj)
equals in class Object
public void resetOut(OutputStream out,
boolean copyOldContent)
throws IOException
out - the new output streamcopyOldContent - flag indicating if the old content should be copied
IOException
public static void copyStream(InputStream in,
OutputStream out,
int bufferSize)
throws IOException
IOExceptionpublic int size()
public byte[] getBytes()
throws IOException
IOException
public void writeCacheTo(OutputStream out)
throws IOException
IOException
public void writeCacheTo(StringBuilder out,
int limit)
throws IOException
IOException
public void writeCacheTo(StringBuilder out)
throws IOException
IOExceptionpublic OutputStream getOut()
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
protected void onWrite()
throws IOException
IOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOException
public void write(byte[] b)
throws IOException
write in class OutputStreamIOException
public void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic File getTempFile()
public InputStream getInputStream()
throws IOException
IOException
public StreamCache getStreamCache()
throws IOException
IOException
public void setOutputDir(File outputDir)
throws IOException
IOExceptionpublic void setThreshold(long threshold)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||