org.norther.tammi.acorn.io
Class ReaderInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.norther.tammi.acorn.io.ReaderInputStream
All Implemented Interfaces:
Closeable

public class ReaderInputStream
extends InputStream

An input stream reading UTF-16 chars directly from a reader.

Note that BOMs are skipped.

Version:
$Id: ReaderInputStream.java,v 1.7 2009/09/28 15:08:49 cvsimp Exp $
Author:
Ilkka Priha

Constructor Summary
ReaderInputStream(Reader r)
          Constructs a new stream.
ReaderInputStream(Reader r, boolean s)
          Constructs a new stream optionally stripping the high order byte.
 
Method Summary
 int read()
           
 int read(byte[] bb, int off, int len)
           
protected  int readChar()
          Reads one character.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderInputStream

public ReaderInputStream(Reader r)
Constructs a new stream.

Parameters:
r - the reader.

ReaderInputStream

public ReaderInputStream(Reader r,
                         boolean s)
Constructs a new stream optionally stripping the high order byte.

Parameters:
r - the reader.
s - true to strip, false otherwise.
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

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

readChar

protected int readChar()
                throws IOException
Reads one character.

Returns:
the character.
Throws:
IOException - on I/O errors.


Copyright © 2004 The Norther Organization. All rights reserved.