org.mmbase.util
Class EncodingDetectingOutputStreamWriter
java.lang.Object
java.io.Writer
org.mmbase.util.EncodingDetectingOutputStreamWriter
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
public class EncodingDetectingOutputStreamWriter
- extends Writer
Like OutputStreamWriter but it tries to autodetect the encoding of the
OutputStream. This works at least if the OutputStream is XML, which is a very common thing to be for Resources.
For this to work at least the first part (e.g. the first 100 bytes) need to be buffered.
If determining the encoding did not succeed it is supposed to be 'UTF-8', which is (should be) an
acceptable encoding, and also the default encoding for XML streams.
- Since:
- MMBase-1.8
- Version:
- $Id: EncodingDetectingOutputStreamWriter.java 41036 2010-02-15 22:30:54Z michiel $
- Author:
- Michiel Meeuwissen
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EncodingDetectingOutputStreamWriter
EncodingDetectingOutputStreamWriter(OutputStream os)
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Specified by:
close in class Writer
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush in interface Flushable- Specified by:
flush in class Writer
- Throws:
IOException
write
public void write(char[] cbuf)
throws IOException
- Overrides:
write in class Writer
- Throws:
IOException
write
public void write(int c)
throws IOException
- Overrides:
write in class Writer
- Throws:
IOException
write
public void write(String str)
throws IOException
- Overrides:
write in class Writer
- Throws:
IOException
write
public void write(String str,
int off,
int len)
throws IOException
- Overrides:
write in class Writer
- Throws:
IOException
write
public void write(char[] cbuf,
int off,
int len)
throws IOException
- Specified by:
write in class Writer
- Throws:
IOException
MMBase 2.0-SNAPSHOT - null