fileoutputstream.java

来自「kaffe是一个java虚拟机的源代码。里面包含了一些java例程和标准的jav」· Java 代码 · 共 90 行

JAVA
90
字号
/* * Java core library component. * * Copyright (c) 1997, 1998 *      Transvirtual Technologies, Inc.  All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. */package java.io;public class FileOutputStream  extends OutputStream {static {        System.loadLibrary("io");}private FileDescriptor fd = new FileDescriptor();public FileOutputStream(File file) throws IOException{	this(file.getPath());}public FileOutputStream(FileDescriptor fdObj)	{	final SecurityManager sm = System.getSecurityManager();	if (sm != null)		sm.checkWrite(fdObj);	fd = fdObj;}public FileOutputStream(String name) throws FileNotFoundException{	this(name, false);}public FileOutputStream(String name, boolean append) throws FileNotFoundException{	final SecurityManager sm = System.getSecurityManager();	if (sm != null)		sm.checkWrite(name);	if (!append) {		open(name);	}	else {		openAppend(name);	}}native public void close() throws IOException;protected void finalize() throws IOException{	close();	try {	    super.finalize();	}	catch(Throwable e){	    throw new IOException(e.getMessage());	}}final public FileDescriptor getFD()  throws IOException{	return (fd);}native private void open(String name);native private void openAppend(String name);public void write(byte b[]) throws IOException{	write(b, 0, b.length);}public void write(byte b[], int off, int len) throws IOException{	writeBytes(b, off, len);}native public void write(int b) throws IOException;native private void writeBytes(byte b[], int off, int len);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?