com.caucho.vfs
Class OldByteToChar

java.lang.Object
  extended by java.io.InputStream
      extended by com.caucho.vfs.AbstractByteToChar
          extended by com.caucho.vfs.ByteToChar
              extended by com.caucho.vfs.OldByteToChar
All Implemented Interfaces:
java.io.Closeable

public final class OldByteToChar
extends ByteToChar

Utility class for converting a byte stream to a character stream.

 ByteToChar converter = new ByteToChar();
 converter.setEncoding("utf-8");
 converter.clear();

 converter.addChar('H');
 converter.addByte(0xc0);
 converter.addByte(0xb8);

 String value = converter.getConvertedString();
 


Method Summary
 void addByte(int b)
          Adds the next byte.
 void addChar(char nextCh)
          Adds the next character.
 void clear()
          Clears the converted
 java.lang.String getConvertedString()
          Gets the converted string.
 void setEncoding(java.lang.String encoding)
          Sets the encoding for the converter.
 java.lang.String toString()
          Prints the object.
 
Methods inherited from class com.caucho.vfs.ByteToChar
create, outputChar
 
Methods inherited from class com.caucho.vfs.AbstractByteToChar
flush, read
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setEncoding

public void setEncoding(java.lang.String encoding)
                 throws java.io.UnsupportedEncodingException
Sets the encoding for the converter.

Overrides:
setEncoding in class AbstractByteToChar
Throws:
java.io.UnsupportedEncodingException

clear

public void clear()
Clears the converted

Overrides:
clear in class ByteToChar

getConvertedString

public java.lang.String getConvertedString()
                                    throws java.io.IOException
Gets the converted string.

Overrides:
getConvertedString in class ByteToChar
Throws:
java.io.IOException

addByte

public void addByte(int b)
             throws java.io.IOException
Adds the next byte.

Overrides:
addByte in class AbstractByteToChar
Parameters:
b - the byte to write
Throws:
java.io.IOException

addChar

public void addChar(char nextCh)
             throws java.io.IOException
Adds the next character.

Overrides:
addChar in class AbstractByteToChar
Parameters:
nextCh - the character to write
Throws:
java.io.IOException

toString

public java.lang.String toString()
Prints the object.

Overrides:
toString in class ByteToChar