java.io
Class FileOutputStream
java.io.FileOutputStream
- public class FileOutputStream
A file output stream is an output stream for writing data to a File or to a FileDescriptor.
Constructor Summary |
FileOutputStream(File file)
Creates a FileInputStream by opening a connection to an actual file, the file named by the File object file in the file system. |
Method Summary |
void |
close()
Closes this file output stream and releases any system resources associated with this stream. |
void |
write(byte[] buf,
int off,
int len)
Writes len bytes from the specified byte array starting at offset off to this file output stream. |
void |
write(int b)
Writes the specified byte to this file output stream. |
FileOutputStream
public FileOutputStream(File file)
throws IOException
- Creates a FileInputStream by opening a connection to an actual file, the file named by the File object file in the file system.
- Parameters:
file
- - the file to be opened for reading.- Throws:
- IOException - if the file exists but is a directory
rather than a regular file, does not exist but cannot be
created, or cannot be opened for any other reason
close
public void close()
throws IOException
- Closes this file output stream and releases any system resources associated with this stream.
- Throws:
- IOException - if an I/O error occurs.
write
public void write(int b)
throws IOException
- Writes the specified byte to this file output stream.
- Parameters:
b
- the byte to be written.- Throws:
- IOException - if an I/O error occurs.
write
public void write(byte[] buf,
int off,
int len)
throws IOException
- Writes len bytes from the specified byte array starting at offset off to this file output stream.
- Parameters:
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.- Throws:
- IOException - if an I/O error occurs.