|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.abstracthorizon.mercury.common.io.TempStorage
public class TempStorage
This is temporary storage. It stores first defined number of bytes in memory and if more are written then it creates a temporary file and continues to write to the file
Nested Class Summary | |
---|---|
protected class |
TempStorage.OutputStreamImpl
Output stream implementation |
Field Summary | |
---|---|
protected ByteArrayOutputStream |
buffer
Buffer array output stream |
protected OutputStream |
defaultOutputStream
Default output stream |
protected File |
file
Temporary file |
static int |
MAX_MEMORY
Default maximum number of bytes to be stored in memory |
protected int |
maxMemory
Number of bytes to be stored in memory |
protected OutputStream |
os
Output stream |
protected String |
prefix
Prefix |
protected int |
size
Size |
protected String |
suffix
Suffix |
Constructor Summary | |
---|---|
TempStorage()
Constructor |
|
TempStorage(String prefix,
String suffix)
Constructor |
|
TempStorage(String prefix,
String suffix,
int maxMemory)
Constructor |
Method Summary | |
---|---|
void |
clear()
Clears storage for new use |
File |
getFile()
Returns temporary file (or null) |
InputStream |
getInputStream()
Returns input stream (file or memory buffer) |
OutputStream |
getOutputStream()
Returns default output stream |
int |
getSize()
Returns size of storage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_MEMORY
protected int maxMemory
protected File file
protected OutputStream defaultOutputStream
protected OutputStream os
protected ByteArrayOutputStream buffer
protected int size
protected String prefix
protected String suffix
Constructor Detail |
---|
public TempStorage()
public TempStorage(String prefix, String suffix)
prefix
- file prefixsuffix
- file suffixpublic TempStorage(String prefix, String suffix, int maxMemory)
prefix
- prefixsuffix
- suffixmaxMemory
- maximum number of bytesMethod Detail |
---|
public File getFile()
public int getSize()
public OutputStream getOutputStream()
public InputStream getInputStream() throws IOException
IOException
public void clear() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |