public class FileOutputStream extends OutputStream
Constructor and Description |
---|
FileOutputStream(File f)
create a new OutputStream to write to this file, starting at the beginning of the file.
|
FileOutputStream(File f,
boolean append)
create a new OutputStream to write to this file
|
FileOutputStream(String name)
This method initializes a
FileInputStream to read from the
specified named file. |
FileOutputStream(String name,
boolean append) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Write the buffer to flash memory and update the file parameters in flash.
|
void |
flush()
This method forces any data that may have been buffered to be written
to the underlying output device.
|
void |
write(int b)
write 1 byte to the file; if necessary, file will be moved become the last file in memory
|
write, write
public FileOutputStream(File f) throws FileNotFoundException, IOException
f
- the file this stream writes toFileNotFoundException
IOException
public FileOutputStream(File f, boolean append) throws IOException
f
- the file this stream writes toappend
- if true this stream will start writing at the end of the file, otherwise at the beginningIOException
public FileOutputStream(String name) throws IOException
FileInputStream
to read from the
specified named file. A security check is first made to determine
whether or not access to this file is allowed. This is done by
calling the checkRead()
method of the
SecurityManager
(if one exists) with the name of this file. An exception is thrown
if reading is not allowed. If the file does not exist, an exception
is also thrown.name
- The name of the file this stream should read fromIOException
public FileOutputStream(String name, boolean append) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in class OutputStream
IOException
- If an error occurspublic void flush() throws IOException
OutputStream
This method in this class does nothing.
flush
in interface Flushable
flush
in class OutputStream
IOException
- If an error occurspublic void write(int b) throws IOException
write
in class OutputStream
b
- The byte to be written to the output stream, passed as
the low eight bits of an int
IOException
- If an error occurs