com.xce.io
Class FileOutputStream

com.xce.io.FileOutputStream

public class FileOutputStream

The implementation of simple file output stream. This class privides functions to write to file.

You can open stdout(standard output stream) and stderr(standard error stream) by a constructor:

new FileOutputStream(XFile.STDOUT); new FileOutputStream(XFile.STDERR);

And you can also open any file to write by following constructor:

new FileOutputStream("FileName");


Field Summary
protected  XFile file
           
 
Constructor Summary
FileOutputStream(int fd)
          A constructor to open STDOUT and STDERR.
FileOutputStream(com.xce.io.String name)
          A constructor to open specified file to write.
FileOutputStream(com.xce.io.String name, boolean truncate)
          A constructor to open speicified file to write(or append)
FileOutputStream(XFile file)
           
 
Method Summary
 void close()
          Close this file.
 void flush()
          Flushes this file.
 void write(byte[] b, int off, int len)
          Write b to the file.
 void write(int b)
          Writes a byte.
 

Field Detail

file

protected XFile file
Constructor Detail

FileOutputStream

public FileOutputStream(int fd)
A constructor to open STDOUT and STDERR.
Parameters:
fd - must be FileOutputStream.STDOU or FilOutputStream.STDERR.
Throws:
IllegalArgumentException - if fd is not STDIN

FileOutputStream

public FileOutputStream(com.xce.io.String name)
                 throws java.io.IOException
A constructor to open specified file to write.
Parameters:
name - the file name to write.
Throws:
java.io.IOException -  

FileOutputStream

public FileOutputStream(com.xce.io.String name,
                        boolean truncate)
                 throws java.io.IOException
A constructor to open speicified file to write(or append)
Parameters:
name - the file name to write(or append)
truncate - if the value is true and the file is exists, it will be truncated. Otherwise, will not be trucated.
Throws:
java.io.IOException -  

FileOutputStream

public FileOutputStream(XFile file)
                 throws java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Close this file.

flush

public void flush()
           throws java.io.IOException
Flushes this file.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Write b to the file.

write

public void write(int b)
           throws java.io.IOException
Writes a byte. Same as write(b, 0, b.length).