com.healthmarketscience.rmiio.util
Class SingleByteAdapter

java.lang.Object
  extended by com.healthmarketscience.rmiio.util.SingleByteAdapter

public final class SingleByteAdapter
extends Object

Adapts a single byte read/write call to the corresponding call to a byte array read/write call. Yeah, I know it seems trivial, but I use it everywhere I implement an InputStream or OutputStream. This class is not synchronized.

Author:
James Ahlborn

Constructor Summary
SingleByteAdapter()
           
 
Method Summary
 int read(InputStream istream)
          Calls InputStream.read(byte[],int,int) on the given InputStream using an internal buffer, and returns the relevant result (either the end of stream flag or the byte that was read).
 void write(int b, OutputStream ostream)
          Calls OutputStream.write(byte[],int,int) on the given OutputStream using an internal buffer with the given byte written to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleByteAdapter

public SingleByteAdapter()
Method Detail

write

public void write(int b,
                  OutputStream ostream)
           throws IOException
Calls OutputStream.write(byte[],int,int) on the given OutputStream using an internal buffer with the given byte written to it.

Throws:
IOException

read

public int read(InputStream istream)
         throws IOException
Calls InputStream.read(byte[],int,int) on the given InputStream using an internal buffer, and returns the relevant result (either the end of stream flag or the byte that was read).

Throws:
IOException


Copyright © 2006–2016 Health Market Science. All rights reserved.