org.norther.tammi.acorn.io
Class UnicodeInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by org.norther.tammi.acorn.io.UnicodeInputStream
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
FileInputStream

public class UnicodeInputStream
extends BufferedInputStream

A buffered input stream with Unicode BOM recognition.

Version:
$Id: UnicodeInputStream.java,v 1.7 2009/09/29 12:34:42 cvsimp Exp $
Author:
Ilkka Priha

Field Summary
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
UnicodeInputStream(InputStream input)
          Constructs a new stream.
UnicodeInputStream(InputStream input, String enc)
          Constructs a new stream with an encoding check.
 
Method Summary
 void close()
           
 String getEncoding()
          Gets the Unicode encoding of this stream.
 int read()
           
 int read(byte[] b, int off, int len)
           
 long skip(long n)
           
 
Methods inherited from class java.io.BufferedInputStream
available, mark, markSupported, reset
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnicodeInputStream

public UnicodeInputStream(InputStream input)
Constructs a new stream.

Parameters:
input - the non-buffered stream.

UnicodeInputStream

public UnicodeInputStream(InputStream input,
                          String enc)
                   throws IOException
Constructs a new stream with an encoding check.

Parameters:
input - the non-buffered stream.
enc - an optional default encoding.
Throws:
IOException - on I/O errors.
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class BufferedInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class BufferedInputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class BufferedInputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class BufferedInputStream
Throws:
IOException

getEncoding

public String getEncoding()
                   throws IOException
Gets the Unicode encoding of this stream.

Returns:
the Unicode encoding or the default encoding.
Throws:
IOException - on I/O errors.


Copyright © 2004 The Norther Organization. All rights reserved.