MDi JLib
1.7.4

com.microdeveloper.util.io
Class FileOut

java.lang.Object
  extended by java.io.Writer
      extended by java.io.BufferedWriter
          extended by com.microdeveloper.util.io.FileOut
All Implemented Interfaces:
Closeable, Flushable, Appendable

public final class FileOut
extends BufferedWriter

Writes data out to a disk file.

Example usage of FileOut:

 

String[] s;

FileOut f = new FileOut( "file.txt" ); for( int i = 0 ; i < s.length ; i++ ) { f.println( s[ i ] ); } f.close();

Since:
1.7.4
Version:
1.0
Author:
MicroDeveloper, Inc.

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
FileOut(String filename)
          Create a new FileOut object that will start writing at the beginning of the file.
FileOut(String filename, boolean append)
          Same as the other constructor only this will open the file for appending.
 
Method Summary
 void print(String s)
          Send a line of text to the file.
 void println()
          Send a newline to the file.
 void println(String s)
          Send a line of text to the file with a trailing new line appropriate for the o/s.
 void writeLine(String s)
          Send a line of text to the file with a trailing new line appropriate for the o/s.
 
Methods inherited from class java.io.BufferedWriter
close, flush, newLine, write, write, write
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileOut

public FileOut(String filename)
        throws IOException
Create a new FileOut object that will start writing at the beginning of the file.

Throws:
IOException

FileOut

public FileOut(String filename,
               boolean append)
        throws IOException
Same as the other constructor only this will open the file for appending.

Parameters:
filename - The name of the file to open.

append - Pass in "true" to append.

Throws:
IOException
Method Detail

println

public void println(String s)
             throws IOException
Send a line of text to the file with a trailing new line appropriate for the o/s.

Parameters:
s - The string to send.

Throws:
IOException

println

public void println()
             throws IOException
Send a newline to the file.

Throws:
IOException

writeLine

public void writeLine(String s)
               throws IOException
Send a line of text to the file with a trailing new line appropriate for the o/s.

Parameters:
s - The string to send.

Throws:
IOException

print

public void print(String s)
           throws IOException
Send a line of text to the file.

Newlines embedded in the string are properly converted. If that is not what you want, call write() instead.

Parameters:
s - The string to send.

Throws:
IOException

MDi JLib
1.7.4

Copyright©2001-2007 MicroDeveloper, Inc. All Rights Reserved.