OutputStreamWriter in Java

0
37
Spread the love
  • 24
  • 34
  • 28
  • 12
  •  
  •  
  •  
  • 10
  •  
  •  
    108
    Shares

OutputStreamWriter in Java
OutputStreamWriter in Java

OutputStreamWriter in Java:

This category of classes decides where our output will go.It may go an array of bytes(No String) or by chacterers.We can create Arrays of bytes a file or a Pipe.
In addition,the FilterOutputStream provides a base class for classes that attach 
  1. attributes
  2. useful interfaces 
to OutputStream.
OutputStreamWriter is a character OutputStream that writes data as byte OutputStream so when characters are written to an OutputStreamWriter , it translate them to bytes according to the Locale info or according to platform specific character encoding.After conversion it writes those bytes to the specified OutputStream.
getEncoding() method returns the name of the encoding being used to convert characters to byte.

The class structure of OutputStreamWriter is given as:


public class java.io.OutputStreamWriter extends 
             java.io.Writer{
//constructor
public OutputStreamWriter(OutputStream out,String encoding) 
throws UnsupportedEncodingException;
public OutputStreamWriter(OutputStream out);
//methods:
public void close() throws IOException;
public void flush() throws IOException;
public String getEncoding(();
public void write(int c) throws IOException;
public void write(char[] cbuffer,int offset,int length) throws IOException;
public void write(String str,int offset,int length) throws IOException;
}
 
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 24
  • 34
  • 28
  • 12
  •  
  •  
  •  
  • 10
  •  
  •  
    108
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here