Package com._1c.g5.v8.dt.core.streams
Class BufferCharReader
- java.lang.Object
-
- com._1c.g5.v8.dt.core.streams.BufferCharReader
-
public class BufferCharReader extends Object
Bridge from byte stream to character stream. it likes toInputStreamReader
Also it supports method "peek" for one character
-
-
Field Summary
Fields Modifier and Type Field Description static char
CHAR_END_OF_STREAM
-
Constructor Summary
Constructors Constructor Description BufferCharReader(InputStream in)
BufferCharReader(InputStreamReader stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
close streamInputStreamReader
getStream()
boolean
isEOF()
Was reached or not end of streamchar
peek()
Read one character from stream without extracting it.int
read(char[] buf)
Reads characters into an array.int
read(char[] buf, int offset, int length)
Reads characters into a portion of an array.char
readChar()
Read one character with extracting itlong
skip(long n)
Skips characters.
-
-
-
Field Detail
-
CHAR_END_OF_STREAM
public static final char CHAR_END_OF_STREAM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BufferCharReader
public BufferCharReader(InputStream in)
-
BufferCharReader
public BufferCharReader(InputStreamReader stream)
-
-
Method Detail
-
getStream
public InputStreamReader getStream()
- Returns:
- corresponding
InputStreamReader
-
peek
public char peek() throws IOException
Read one character from stream without extracting it.- Returns:
- Read character or CHAR_END_OF_STREAM if end of stream was reached
- Throws:
IOException
-
readChar
public char readChar() throws IOException
Read one character with extracting it- Returns:
- Read character or CHAR_END_OF_STREAM if end of stream was reached
- Throws:
IOException
-
read
public int read(char[] buf) throws IOException
Reads characters into an array.- Parameters:
buf
- Destination buffer- Returns:
- The number of characters read, or -1 if the end of the stream has been reached
- Throws:
IOException
- See Also:
.read(char[] cbuf)
-
read
public int read(char[] buf, int offset, int length) throws IOException
Reads characters into a portion of an array.- Parameters:
buf
- Destination bufferoffset
- Offset at which to start storing characterslength
- Maximum number of characters to read- Returns:
- The number of characters read, or -1 if the end of the stream has been reached
- Throws:
IOException
- See Also:
.read(har[] cbuf, int offset, int length)
-
isEOF
public boolean isEOF() throws IOException
Was reached or not end of stream- Returns:
- true, if was reached
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.- Parameters:
n
- The number of characters to skip- Returns:
- The number of characters actually skipped
- Throws:
IOException
-
close
public void close() throws IOException
close stream- Throws:
IOException
-
-