org.montsuqi.monsia
Class FakeEncodingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.montsuqi.monsia.FakeEncodingInputStream
All Implemented Interfaces:
java.io.Closeable

final class FakeEncodingInputStream
extends java.io.InputStream

An InputStream to read glade 1.0 screen definition file.

Since glade 1.0's screen definitions are written in EUC-JP but does not have encoding in xml declaration, normal xml parser cannot read them correctly.

This class fakes xml encoding parameter to solve this problem.


Field Summary
(package private)  byte[] headerBytes
           
 
Constructor Summary
FakeEncodingInputStream(java.io.InputStream in)
           
 
Method Summary
 int read()
          To fake xml encoding, this method returns bytes in FAKE_HEADER string while the index is less than FAKE_HEADER's length.
 
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, toString, wait, wait, wait
 

Field Detail

headerBytes

byte[] headerBytes
Constructor Detail

FakeEncodingInputStream

public FakeEncodingInputStream(java.io.InputStream in)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException

To fake xml encoding, this method returns bytes in FAKE_HEADER string while the index is less than FAKE_HEADER's length. When it read all from FAKE_HEADER, it returns bytes actually read.

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException