KickJava   Java API By Example, From Geeks To Geeks.

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

java.io
Class OutputStreamWriter

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

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


[1432]Output french characters to the console
By Anonymous on 2005/05/17 11:30:07  Rate
//Output french characters to the console 
  
  
 //Since Java string are Unicode encoded, you must specified a  
 //different encoding when printing to a DOS console. This is done via  
 //the OutputStreamWriter class.  
  
  
 import java.io.*; 
  
  
 public class DosString  {  
   public static void main ( String args [  ]  )  {  
     String javaString =  
       "caract??res fran??ais : ?? ?? \u00e9"; // Unicode for "??" 
     try  {  
       // output to the console 
       Writer w =  
         new BufferedWriter 
             ( new OutputStreamWriter ( System.out, "Cp850" )  ) ; 
       w.write ( javaString ) ; 
       w.flush (  ) ; 
       w.close (  ) ;   
        }  
    catch  ( Exception e )   {  
       e.printStackTrace (  ) ; 
        }  
     }  
    }  
   
 


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


public String getEncoding()
See Also:
Charset, OutputStreamWriter(OutputStream, String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


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


public OutputStreamWriter(OutputStream out,
                          String charsetName)
                   throws UnsupportedEncodingException
See Also:
charset
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public OutputStreamWriter(OutputStream out,
                          Charset cs)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public OutputStreamWriter(OutputStream out,
                          CharsetEncoder enc)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


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 str,
                  int off,
                  int len)
           throws IOException
See Also:
Writer
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags