|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
wt.util.TempFileOutputStream
This class is designed to be used much like a ByteArrayOutputStream
,
the primary difference being that output is written to a temporary file
as oppose to consuming memory with a byte array.
Note: The dispose
method should be called to delete the temporary file and free all
related resources when no longer needed.
Supported API: true
Extendable: false
Field Summary | |
private static int |
bufSiz
|
private static boolean |
DEBUG
|
(package private) File |
f
|
(package private) int |
length
|
(package private) RandomAccessFile |
raf
|
private static String |
TEMPDIR
|
private static String |
versionID
|
Constructor Summary | |
TempFileOutputStream()
Construct a new TempFileOutputStream object. |
|
TempFileOutputStream(int buffer_size)
Construct a new TempFileOutputStream object
specifying the write buffer size. |
Method Summary | |
void |
dispose()
Dispose of resources associated with this TempFileOutputStream . |
protected void |
finialize()
finialize this object, cleans up temp file resources if dispose is never called. |
private static int |
getBufSiz()
|
int |
getLength()
Get the size of the temporary file. |
static void |
main(String[] args)
Test driver (main) Supported API: true |
private void |
readInputFile(String file_name,
TempFileOutputStream tf)
|
int |
size()
Get the size of the temporary file. |
void |
write(byte[] b)
Writes b.length bytes to this TempFileOutputStream . |
void |
write(byte[] b,
int off,
int len)
Write data to this TempFileOutputStream . |
void |
write(int b)
Write data to this TempFileOutputStream . |
void |
writeTo(OutputStream os)
Write temp file data to some OutputStream. |
Methods inherited from class java.io.OutputStream |
close, flush |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
File f
RandomAccessFile raf
int length
private static final String versionID
private static final String TEMPDIR
private static final boolean DEBUG
private static int bufSiz
Constructor Detail |
public TempFileOutputStream() throws IOException
TempFileOutputStream
object.
IOException
- If unable to open the temporary file.public TempFileOutputStream(int buffer_size) throws IOException
TempFileOutputStream
object
specifying the write buffer size.
buffer_size
-
IOException
- If unable to open the temporary file.Method Detail |
public int size()
public int getLength()
public void write(byte[] b, int off, int len) throws IOException
TempFileOutputStream
.
b
- a byte array of data to be written to temporary fileoff
- offset into the byte arraylen
- amout of data to be written
IOException
- if a write error occurs.public void write(int b) throws IOException
TempFileOutputStream
.
b
- a byte array of data to be written to temporary file
IOException
- if a write error occurs.public void write(byte[] b) throws IOException
b.length
bytes to this TempFileOutputStream
.
b
- a byte array of data to be written to temporary file
IOException
- if a write error occurs.public void writeTo(OutputStream os) throws IOException
os
- OutputStream which is to recievie the temp files contents
IOException
- if a read or write error errors.public void dispose()
TempFileOutputStream
.
The temporary file is closed and deleted.
protected void finialize() throws Throwable
Throwable
private static int getBufSiz()
private void readInputFile(String file_name, TempFileOutputStream tf) throws Exception
Exception
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |