java.lang.Object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.io.Writer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.io.OutputStreamWriter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.io.FileWriter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FileWriter is for writing streams of characters.
Constructor | Summary |
---|---|
FileWriter(File file) | Creates a FileWriter object given a File object. |
FileWriter(File file, boolean append) | Creates a FileWriter object given a File object. |
FileWriter(FileDescriptor fd) | Creates a FileWriter object associated with a file descriptor. |
FileWriter(String fileName) | Creates a FileWriter object given a file name. |
FileWriter(String fileName, boolean append) | Creates a FileWriter object given a file name with a boolean indicating whether or not to append the data written. |
Methods inherited from class java.io.OutputStreamWriter
Return | Method | Summary |
---|---|---|
void | close() | Closes the stream, flushing it first. |
void | flush() | Flushes the stream. |
String | getEncoding() | Returns the name of the character encoding being used by this stream. |
void | write(char[] cbuf, int off, int len) | Writes a portion of an array of characters. |
void | write(int c) | Writes a single character. |
void | write(String str, int off, int len) | Writes a portion of a string. |
import java.io.FileWriter;
public class Main {
public static void main(String args[]) throws Exception {
FileWriter fw = new FileWriter(args[0]);
for (int i = 0; i < 12; i++) {
fw.write("Line " + i + " java2s.com \n");
}
fw.close();
}
}
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |