public class RandomFileOutputStream extends OutputStream
Threading Design : [x] Single Threaded [ ] Threadsafe [ ] Immutable [ ] Isolated From http://stackoverflow.com/questions/825732/how-can-i-implement-an-outputstream-that-i-can-rewind
| Modifier and Type | Field and Description |
|---|---|
protected RandomAccessFile |
randomFile |
protected boolean |
sync |
| Constructor and Description |
|---|
RandomFileOutputStream(File fil) |
RandomFileOutputStream(File fil,
boolean syn) |
RandomFileOutputStream(String fnm) |
RandomFileOutputStream(String fnm,
boolean syn) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
FileDescriptor |
getFD() |
long |
getFilePointer() |
long |
getFileSize() |
void |
setFilePointer(long pos) |
void |
setFileSize(long len) |
void |
write(byte[] val) |
void |
write(byte[] val,
int off,
int len) |
void |
write(int val) |
protected RandomAccessFile randomFile
protected boolean sync
public RandomFileOutputStream(String fnm) throws IOException
IOExceptionpublic RandomFileOutputStream(String fnm, boolean syn) throws IOException
IOExceptionpublic RandomFileOutputStream(File fil) throws IOException
IOExceptionpublic RandomFileOutputStream(File fil, boolean syn) throws IOException
IOExceptionpublic void write(int val)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] val)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] val,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic long getFilePointer()
throws IOException
IOExceptionpublic void setFilePointer(long pos)
throws IOException
IOExceptionpublic long getFileSize()
throws IOException
IOExceptionpublic void setFileSize(long len)
throws IOException
IOExceptionpublic FileDescriptor getFD() throws IOException
IOException