Package net.sf.okapi.common
Class UnicodeBOMWriter
- java.lang.Object
-
- java.io.Writer
-
- net.sf.okapi.common.UnicodeBOMWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class UnicodeBOMWriter extends Writer
An UnicodeBOMWriter is a thin wrapper aroundOutputStreamWriter, except that it adds a BOM (Byte Order Mark) at the beginning;For documentation on the behavior in case of invalid Unicode sequences (malformed surrogates, etc.) see the doc for
OutputStreamWriter- See Also:
Charset,OutputStream,OutputStreamWriter
-
-
Constructor Summary
Constructors Constructor Description UnicodeBOMWriter(File file, String charsetName)Creates an UnicodeBOMWriter that uses the named charset.UnicodeBOMWriter(String fileName, String charsetName)Creates an UnicodeBOMWriter that uses the named charset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(char[] cbuf, int off, int len)
-
-
-
Constructor Detail
-
UnicodeBOMWriter
public UnicodeBOMWriter(File file, String charsetName) throws IOException
Creates an UnicodeBOMWriter that uses the named charset.- Parameters:
file- The outputFileto write tocharsetName- The name of a supportedCharset- Throws:
IOException- If the encoding is not supported or any problems writing to the stream
-
UnicodeBOMWriter
public UnicodeBOMWriter(String fileName, String charsetName) throws IOException
Creates an UnicodeBOMWriter that uses the named charset.- Parameters:
fileName- The name of the output filecharsetName- The name of a supportedCharset- Throws:
IOException- If the encoding is not supported or any problems writing to the stream
-
-
Method Detail
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Specified by:
writein classWriter- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
-