public class ByteArrayBackupToFileOutputStream extends OutputStream
OutputStream that will write to an byte array before overflowing to a file| Constructor and Description |
|---|
ByteArrayBackupToFileOutputStream()
constructor with default settings
|
ByteArrayBackupToFileOutputStream(int initialBufferSize,
int sizeBeforeOverFlow)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
copyToOutputStream(OutputStream outputStream)
Copy the contents of this
OutputStream to a new OutputStream. |
long |
getLength()
get the byte length of the
OutputStream |
InputStream |
getNewInputStream()
create an
InputStream based on the data written to the OutputStream |
void |
mark()
Marks the current position in this input stream.
|
void |
reset()
Repositions this stream to the position at the time the mark method was
last called on this input stream.
|
void |
setLength(long length)
set the length of the
OutputStream |
long |
size()
get the number or bytes written to the
OutputStream |
String |
toHex()
convert the current buffer for text...
|
String |
toString() |
void |
unwrite()
remove one byte from the written outputstream
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
flush, writepublic ByteArrayBackupToFileOutputStream()
public ByteArrayBackupToFileOutputStream(int initialBufferSize,
int sizeBeforeOverFlow)
initialBufferSize - initial buffer size in bytessizeBeforeOverFlow - size in bytes before overflow to filepublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void unwrite()
throws IOException
IOException - if there is no more buffer to unwrite frompublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic long size()
OutputStreampublic String toHex()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic InputStream getNewInputStream() throws IOException
InputStream based on the data written to the OutputStreamInputStreamIOException - if the OutputStream can not be flushed or closedpublic void copyToOutputStream(OutputStream outputStream) throws IOException
OutputStream to a new OutputStream.outputStream - IOExceptionpublic void mark()
throws IOException
IOException - if the length of OutputStream cannot be retrievedpublic void reset()
throws IOException
IOException - if the length of OutputStream cannot be setpublic void setLength(long length)
throws IOException
OutputStreamlength - the length in bytesIOException - if the length is greater than the OutputStream sizepublic long getLength()
OutputStreamCopyright © 2022. All rights reserved.