public class UTF16Writer extends OutputStreamWriter
We write the "characters" as raw bytes to prevent Java from changing end of line characters and fixing malformed byte sequences in the data. The data IS THE DATA and it is not up to Java to decide when our data should be "fixed" for us.
This class does nothing but provide some constructors that call the OutputStreamWriter constructor with the appropriate values. No other methods are overridden.
The first constructor takes an OutputStream and calls the superclass constructor setting the encoding to UTF-16. The other constructors use the parameter to construct a java.io.FileOutputStream object and then invoke the first constructor with that.
| Constructor and Description |
|---|
UTF16Writer(File file) |
UTF16Writer(OutputStream out) |
UTF16Writer(String filename) |
close, flush, getEncoding, write, write, writepublic static final String ENCODING
public UTF16Writer(OutputStream out) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic UTF16Writer(String filename) throws FileNotFoundException, UnsupportedEncodingException
public UTF16Writer(File file) throws FileNotFoundException, UnsupportedEncodingException
Copyright © 2016 The American National Corpus. All rights reserved.