com.perforce.p4java.impl.mapbased.rpc.sys
Class RpcUnicodeInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.perforce.p4java.impl.mapbased.rpc.sys.RpcUnicodeInputStream
All Implemented Interfaces:
Closeable

public class RpcUnicodeInputStream
extends 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
static class RpcUnicodeInputStream.BOM
          Types of Unicode BOMs.
 
Constructor Summary
RpcUnicodeInputStream(InputStream inputStream)
          Constructs a new RpcUnicodeInputStream that wraps the InputStream.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcUnicodeInputStream

public RpcUnicodeInputStream(InputStream inputStream)
                      throws NullPointerException,
                             IOException
Constructs a new RpcUnicodeInputStream that wraps the InputStream.

Throws:
NullPointerException
IOException
Method Detail

getBOM

public final RpcUnicodeInputStream.BOM getBOM()
Returns the BOM found in the InputStream.


skipBOM

public final RpcUnicodeInputStream skipBOM()
                                    throws IOException
Skips the BOM found in the InputStream.

Throws:
IOException

read

public int read()
         throws IOException

Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException,
                NullPointerException

Overrides:
read in class InputStream
Throws:
IOException
NullPointerException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException,
                NullPointerException

Overrides:
read in class InputStream
Throws:
IOException
NullPointerException

skip

public long skip(long n)
          throws IOException

Overrides:
skip in class InputStream
Throws:
IOException

available

public int available()
              throws IOException

Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

mark

public void mark(int readlimit)

Overrides:
mark in class InputStream

reset

public void reset()
           throws IOException

Overrides:
reset in class InputStream
Throws:
IOException

markSupported

public boolean markSupported()

Overrides:
markSupported in class InputStream


Copyright © 2015 Perforce Software. All Rights Reserved.