FileOutputStream 是继承与OutputStream的子类数组
1 经常使用属性多线程
2 构造函数app
3 经常使用方法函数
// 写入一个字节到该文件输出流中,调用下边的本地方法
public void write(int b) throws IOException {this
write(b, append);// 调用的是一个native方法
}线程
// 本地方法,写入一个字节到该文件输出流中code
// 将给定的字节数组b中的全部字节写入文件输出流,调用本地方法对象
public void write(byte b[]) throws IOException {继承
writeBytes(b, 0, b.length, append);
}ip
// 将给定的字节数组b中从off开始的len个字节字节写入文件输出流,调用下边的本地方法
public void write(byte b[], int off, int len) throws IOException {
writeBytes(b, off, len, append);
}
// 本地方法,将给定的字节数组b中从off开始的len个字节写入文件输出流
// 关闭流,调用本地的方法
public void close() throws IOException {
synchronized (closeLock) { if (closed) { return; } closed = true; } if (channel != null) { channel.close(); } fd.closeAll(new Closeable() { public void close() throws IOException { close0(); } });
}
// 本地方法,关闭流
// 清理到文件的链接,并确保再也不引用此文件输入流时调用此close的方法
protected void finalize() throws IOException {
if (fd != null) { if (fd == FileDescriptor.out || fd == FileDescriptor.err) { flush(); } else { close(); } }
}
// 获取流对象对应的通道,若是为空就建立一个新的通道
public FileChannel getChannel() {
synchronized (this) { if (channel == null) { channel = FileChannelImpl.open(fd, path, false, true, append, this); } return channel; }
}