jline
Class WindowsTerminal.ReplayPrefixOneCharInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by jline.WindowsTerminal.ReplayPrefixOneCharInputStream
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
WindowsTerminal

static class WindowsTerminal.ReplayPrefixOneCharInputStream
extends java.io.InputStream

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

Author:
Marc Herbert

Field Summary
(package private)  int byteLength
           
(package private)  int byteRead
           
(package private)  java.lang.String encoding
           
(package private)  byte firstByte
           
(package private)  java.io.InputStream wrappedStream
           
 
Constructor Summary
WindowsTerminal.ReplayPrefixOneCharInputStream(java.lang.String encoding)
           
 
Method Summary
 int available()
          InputStreamReader is greedy and will try to read bytes in advance.
 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
 

Field Detail

firstByte

byte firstByte

byteLength

int byteLength

wrappedStream

java.io.InputStream wrappedStream

byteRead

int byteRead

encoding

final java.lang.String encoding
Constructor Detail

WindowsTerminal.ReplayPrefixOneCharInputStream

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

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