Class RpcUnicodeInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.perforce.p4java.impl.mapbased.rpc.sys.RpcUnicodeInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class RpcUnicodeInputStream extends java.io.InputStream
InputStream wrapper that detects and skips the Unicode BOM (Byte Order Mark) in Unicode encoded text files.EF BB BF = UTF-8 BOM FF FE = UTF-16, little-endian BOM FE FF = UTF-16, big-endian BOM FF FE 00 00 = UTF-32, little-endian BOM 00 00 FE FF = UTF-32, big-endian BOM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RpcUnicodeInputStream.BOM
Types of Unicode BOMs.
-
Constructor Summary
Constructors Constructor Description RpcUnicodeInputStream(java.io.InputStream inputStream)
Constructs a new RpcUnicodeInputStream that wraps the InputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
RpcUnicodeInputStream.BOM
getBOM()
Returns the BOM found in the InputStream.void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
reset()
long
skip(long n)
RpcUnicodeInputStream
skipBOM()
Skips the BOM found in the InputStream.
-
-
-
Constructor Detail
-
RpcUnicodeInputStream
public RpcUnicodeInputStream(java.io.InputStream inputStream) throws java.lang.NullPointerException, java.io.IOException
Constructs a new RpcUnicodeInputStream that wraps the InputStream.- Parameters:
inputStream
- inputStream- Throws:
java.lang.NullPointerException
- on errorjava.io.IOException
- on error
-
-
Method Detail
-
getBOM
public final RpcUnicodeInputStream.BOM getBOM()
Returns the BOM found in the InputStream.- Returns:
- BOM
-
skipBOM
public final RpcUnicodeInputStream skipBOM() throws java.io.IOException
Skips the BOM found in the InputStream.- Returns:
- this
- Throws:
java.io.IOException
- on error
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException, java.lang.NullPointerException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
java.lang.NullPointerException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException, java.lang.NullPointerException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
java.lang.NullPointerException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
-