JavaTM Platform
Standard Ed. 6

java.io
�� FileWriter

java.lang.Object
  �̳��� java.io.Writer
      �̳��� java.io.OutputStreamWriter
          �̳��� java.io.FileWriter
������ʵ�ֵĽӿڣ�
Closeable, Flushable, Appendable

public class FileWriter
extends OutputStreamWriter

����д���ַ��ļ��ı���ࡣ����Ĺ��췽���ٶ�Ĭ���ַ������Ĭ���ֽڻ�������С���ǿɽ��ܵġ�Ҫ�Լ�ָ����Щֵ���������� FileOutputStream �Ϲ���һ�� OutputStreamWriter��

�ļ��Ƿ���û��Ƿ���Ա�����ȡ���ڵײ�ƽ̨���ر���ijЩƽ̨һ��ֻ����һ�� FileWriter���������ļ�д����󣩴��ļ�����д�롣����������£�������漰���ļ��Ѿ��򿪣�������еĹ��췽����ʧ�ܡ�

FileWriter ����д���ַ�����Ҫд��ԭʼ�ֽ������뿼��ʹ�� FileOutputStream��

�����°汾��ʼ��
JDK1.1
������
OutputStreamWriter, FileOutputStream

�ֶ�ժҪ
 
���� java.io.Writer �̳е��ֶ�
lock
 
���췽��ժҪ
FileWriter(File file)
          ���ݸ����� File ������һ�� FileWriter ����
FileWriter(File file, boolean append)
          ���ݸ����� File ������һ�� FileWriter ����
FileWriter(FileDescriptor fd)
          ������ij���ļ�������������� FileWriter ����
FileWriter(String fileName)
          ���ݸ������ļ�������һ�� FileWriter ����
FileWriter(String fileName, boolean append)
          ���ݸ������ļ����Լ�ָʾ�Ƿ񸽼�д�����ݵ� boolean ֵ������ FileWriter ����
 
����ժҪ
 
���� java.io.OutputStreamWriter �̳еķ���
close, flush, getEncoding, write, write, write
 
���� java.io.Writer �̳еķ���
append, append, append, write, write
 
���� java.lang.Object �̳еķ���
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

���췽����ϸ��Ϣ

FileWriter

public FileWriter(String fileName)
           throws IOException
���ݸ������ļ�������һ�� FileWriter ����

������
fileName - һ���ַ�������ʾ��ϵͳ�йص��ļ�����
�׳���
IOException - ���ָ���ļ����ڣ�������һ��Ŀ¼��������һ�������ļ������߸��ļ������ڣ����޷����������ֻ���Ϊ����ijЩԭ����޷�����

FileWriter

public FileWriter(String fileName,
                  boolean append)
           throws IOException
���ݸ������ļ����Լ�ָʾ�Ƿ񸽼�д�����ݵ� boolean ֵ������ FileWriter ����

������
fileName - һ���ַ�������ʾ��ϵͳ�йص��ļ�����
append - һ�� boolean ֵ�����Ϊ true��������д���ļ�ĩβ����������д���ļ���ʼ����
�׳���
IOException - ���ָ���ļ����ڣ�������һ��Ŀ¼��������һ�������ļ������߸��ļ������ڣ����޷����������ֻ���Ϊ����ijЩԭ����޷�����

FileWriter

public FileWriter(File file)
           throws IOException
���ݸ����� File ������һ�� FileWriter ����

������
file - Ҫд�����ݵ� File ����
�׳���
IOException - ������ļ����ڣ�������һ��Ŀ¼��������һ�������ļ������߸��ļ������ڣ����޷����������ֻ���Ϊ����ijЩԭ����޷�����

FileWriter

public FileWriter(File file,
                  boolean append)
           throws IOException
���ݸ����� File ������һ�� FileWriter ��������ڶ�������Ϊ true�����ֽ�д���ļ�ĩβ����������д���ļ���ʼ����

������
file - Ҫд�����ݵ� File ����
append - ���Ϊ true�����ֽ�д���ļ�ĩβ����������д���ļ���ʼ��
�׳���
IOException - ������ļ����ڣ�������һ��Ŀ¼��������һ�������ļ������߸��ļ������ڣ����޷����������ֻ���Ϊ����ijЩԭ����޷�����
�����°汾��ʼ��
1.4

FileWriter

public FileWriter(FileDescriptor fd)
������ij���ļ�������������� FileWriter ����

������
fd - Ҫд�����ݵ� FileDescriptor ����

JavaTM Platform
Standard Ed. 6

�ύ��������
�йظ���� API �ο����ϺͿ�����Ա�ĵ�������� Java SE ������Ա�ĵ������ĵ���������ϸ�ġ����򿪷���Ա���������Լ�������������ﶨ�塢ʹ�ü��ɺ͹�������ʾ����

��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������