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; }
}