Package org.openstreetmap.josm.io
Class UTFInputStreamReader
java.lang.Object
java.io.Reader
java.io.InputStreamReader
org.openstreetmap.josm.io.UTFInputStreamReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
Detects the different UTF encodings from byte order mark.
- Since:
- 3372
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UTFInputStreamReadercreate(InputStream input) Creates a newInputStreamReaderfrom theInputStreamwith UTF-8 as default encoding.static UTFInputStreamReadercreate(InputStream input, String defaultEncoding) Creates a newInputStreamReaderfrom theInputStream.Methods inherited from class java.io.InputStreamReader
close, getEncoding, read, read, read, readyMethods inherited from class java.io.Reader
mark, markSupported, nullReader, read, reset, skip, transferTo
-
Constructor Details
-
UTFInputStreamReader
- Throws:
UnsupportedEncodingException
-
-
Method Details
-
create
Creates a newInputStreamReaderfrom theInputStreamwith UTF-8 as default encoding.- Parameters:
input- input stream- Returns:
- A reader with the correct encoding. Starts to read after the BOM.
- Throws:
IOException- if any I/O error occurs- See Also:
-
create
public static UTFInputStreamReader create(InputStream input, String defaultEncoding) throws IOException Creates a newInputStreamReaderfrom theInputStream.- Parameters:
input- input streamdefaultEncoding- Used, when no BOM was recognized. Can be null.- Returns:
- A reader with the correct encoding. Starts to read after the BOM.
- Throws:
IOException- if any I/O error occurs
-