public class OutputStreamWriter extends Writer
| Constructor and Description |
|---|
OutputStreamWriter(OutputStream outputstream)
Creates an instance of OutputStreamWriter.
|
OutputStreamWriter(OutputStream outputstream,
String encoding)
Creates an instance of OutputStreamWriter specifying an encoding.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the output stream.
|
void |
flush()
Flush the output buffer.
|
String |
getEncoding()
Get encoding.
|
void |
write(char[] buff,
int ofs,
int cnt)
Writes subset of a character array to the output stream.
|
void |
write(int ch)
Writes a character to the output stream.
|
void |
write(String str,
int ofs,
int len)
Writes subset of String to output stream.
|
public OutputStreamWriter(OutputStream outputstream)
outputstream - the streampublic OutputStreamWriter(OutputStream outputstream, String encoding) throws UnsupportedEncodingException
outputstream - the streamencoding - the encoding to useUnsupportedEncodingException - if the encoding is not validpublic void close()
throws IOException
close in class WriterIOException - id the output stream is not availablepublic void flush()
throws IOException
flush in class WriterIOException - if the output stream is not availablepublic String getEncoding()
public void write(int ch)
throws IOException
write in class Writerch - the character valueIOException - if the stream is not availablepublic void write(String str, int ofs, int len) throws IOException
write in class Writerstr - String containing data to writeofs - offset to first character in the stringlen - length of data to writeIOException - if the stream is not availablepublic void write(char[] buff,
int ofs,
int cnt)
throws IOException
write in class Writerbuff - array containing characters to be written?ofs - offset of the first character to writecnt - count of characters to be writtenIOException - if the stream is not available