KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > io > BufferedWriter

java.io
Class BufferedWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.BufferedWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable
See Also:
Top Examples, Source Code, PrintWriter, FileWriter, OutputStreamWriter

public BufferedWriter(Writer out)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[59]Read and Write utility
By Anonymous on 2005/05/10 13:03:12  Rate
import java.io.*; 
  
  
 public class readwrite  {  
   public static void main ( String args [  ]  )  
    {  
     if  ( args.length != 2 )   {  
       System.err.println ( "usage: infile outfile\n" ) ; 
       System.exit ( 1 ) ; 
      }  
           
     String in_file = args [ 0 ] ; 
     String out_file = args [ 1 ] ; 
           
     try  {  
       FileReader reader = new FileReader ( in_file ) ; 
       BufferedReader buf_reader = new BufferedReader ( reader ) ; 
       FileWriter writer = new FileWriter ( out_file ) ; 
       BufferedWriter buf_writer = new BufferedWriter ( writer ) ; 
       String ln = null; 
       while  (  ( ln = buf_reader.readLine (  )  )  != null )  {  
         buf_writer.write ( ln ) ; 
         buf_writer.newLine (  ) ; 
        }  
       buf_reader.close (  ) ; 
       buf_writer.close (  ) ; 
      }  
     catch  ( IOException e )   {  
       System.err.println ( e ) ; 
       System.exit ( 1 ) ; 
      }  
    }  
  }  
 


public BufferedWriter(Writer out,
                      int sz)
See Also:
IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void close()
           throws IOException
See Also:
Writer, Closeable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void flush()
           throws IOException
See Also:
Writer, Flushable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void newLine()
             throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1115]New line
By Anonymous on 2005/04/20 16:04:59  Rate
add a new Line into de File

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void write(int c)
           throws IOException
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void write(String s,
                  int off,
                  int len)
           throws IOException
See Also:
Writer, IndexOutOfBoundsException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags