public class UTF8Writer 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-8. The other constructors use the parameter to construct a java.io.FileOutputStream object and then invoke the first constructor with that.
| Constructor and Description |
|---|
UTF8Writer(File file) |
UTF8Writer(OutputStream out) |
UTF8Writer(String filename) |
close, flush, getEncoding, write, write, writepublic static final String ENCODING
public UTF8Writer(OutputStream out) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic UTF8Writer(String filename) throws FileNotFoundException, UnsupportedEncodingException
public UTF8Writer(File file) throws FileNotFoundException, UnsupportedEncodingException
Copyright © 2016 The American National Corpus. All rights reserved.