public final class ChangedFileOutputStream
extends java.io.OutputStream
| Modifier and Type | Field and Description |
|---|---|
private java.io.ByteArrayOutputStream |
m_bos
The output stream used to buffer data being writen.
|
private java.io.File |
m_file
The file to write to.
|
| Constructor and Description |
|---|
ChangedFileOutputStream(java.io.File file)
Creates a new ChangedFileOutputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stream.
|
private byte[] |
readBytes(java.io.File file)
Reads the full contents of a file into a byte array.
|
void |
write(int b)
Writes the specified byte to this output stream.
|
private void |
writeBytes(java.io.File file,
byte[] bytes)
Reads the full contents of a byte array out to a file.
|
private java.io.File m_file
private java.io.ByteArrayOutputStream m_bos
public ChangedFileOutputStream(java.io.File file)
file - The file to write to.public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamb - Byte to write.java.io.IOException - If an I/O error occurs.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException - If an I/O error occurs.private byte[] readBytes(java.io.File file)
throws java.io.IOException
file - File to read.java.io.IOException - If the file could not be read for any reason.private void writeBytes(java.io.File file,
byte[] bytes)
throws java.io.IOException
file - File to write to.bytes - The binary data to write.java.io.IOException - If the file could not be written to for any reason.