jline.internal
Class ReplayPrefixOneCharInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by jline.internal.ReplayPrefixOneCharInputStream
All Implemented Interfaces:
java.io.Closeable

public final class ReplayPrefixOneCharInputStream
extends java.io.InputStream

This is awkward and inefficient, but probably the minimal way to add UTF-8 support to JLine

Since:
2.0
Author:
Marc Herbert, Jason Dillon

Constructor Summary
ReplayPrefixOneCharInputStream(java.lang.String encoding)
           
 
Method Summary
 int available()
          InputStreamReader is greedy and will try to read bytes in advance.
 java.lang.String getEncoding()
           
 int read()
           
 void setInput(int recorded, java.io.InputStream wrapped)
           
 void setInputUTF8(int recorded, java.io.InputStream wrapped)
           
 
Methods inherited from class java.io.InputStream
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
 

Constructor Detail

ReplayPrefixOneCharInputStream

public ReplayPrefixOneCharInputStream(java.lang.String encoding)
Method Detail

getEncoding

public java.lang.String getEncoding()

setInput

public void setInput(int recorded,
                     java.io.InputStream wrapped)
              throws java.io.IOException
Throws:
java.io.IOException

setInputUTF8

public void setInputUTF8(int recorded,
                         java.io.InputStream wrapped)
                  throws java.io.IOException
Throws:
java.io.IOException

read

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

available

public int available()
InputStreamReader is greedy and will try to read bytes in advance. We do NOT want this to happen since we use a temporary/"losing bytes" InputStreamReader above, that's why we hide the real wrappedStream.available() here.

Overrides:
available in class java.io.InputStream