public class CharArrayReader extends Reader
修飾子と型 | フィールド | 説明 |
---|---|---|
protected char[] |
buf |
文字バッファです。
|
protected int |
count |
このバッファの最後のインデックスです。
|
protected int |
markedPos |
バッファ内のマーク位置です。
|
protected int |
pos |
現在のバッファの位置です。
|
コンストラクタ | 説明 |
---|---|
CharArrayReader(char[] buf) |
指定された文字の配列からCharArrayReaderを作成します。
|
CharArrayReader(char[] buf, int offset, int length) |
指定された文字の配列からCharArrayReaderを作成します。
|
修飾子と型 | メソッド | 説明 |
---|---|---|
void |
close() |
ストリームを閉じて、それに関連するすべてのシステム・リソースを解放します。
|
void |
mark(int readAheadLimit) |
ストリームの現在位置にマークを設定します。
|
boolean |
markSupported() |
このストリームが、実行するmark()オペレーションをサポートするかどうかを通知します。
|
int |
read() |
単一の文字を読み込みます。
|
int |
read(char[] b, int off, int len) |
配列の一部に文字を読み込みます。
|
boolean |
ready() |
このストリームが読込み可能かどうかを判定します。
|
void |
reset() |
直前のマーク位置にストリームをリセットします。マークが設定されていない場合は、先頭位置にリセットします。
|
long |
skip(long n) |
文字をスキップします。
|
protected char[] buf
protected int pos
protected int markedPos
protected int count
public CharArrayReader(char[] buf)
buf
- 入力バッファ(コピーされていない)public CharArrayReader(char[] buf, int offset, int length)
結果として得られるリーダーは、指定されたoffsetから読込みを開始します。 このリーダーから読み取ることのできるchar値の総数は、lengthとbuf.length-offsetのいずれか小さい方になります。
buf
- 入力バッファ(コピーされていない)offset
- 読み込む最初の文字オフセットlength
- 読み込む文字数IllegalArgumentException
- offsetが負またはbuf.lengthより大きい場合、lengthが負の場合、またはこれら2つの値の和が負の場合。public int read() throws IOException
read
、クラスReader
IOException
- 入出力エラーが発生した場合public int read(char[] b, int off, int len) throws IOException
read
、クラスReader
b
- 転送先バッファoff
- 文字の格納開始オフセットlen
- 読み込む文字の最大数IOException
- 入出力エラーが発生した場合public long skip(long n) throws IOException
n
パラメータは、Reader
スーパー・クラスのskip
メソッドが例外をスローする場合があっても、負の値にできます。 n
が負の場合、このメソッドは何もせずに0
を返します。
skip
、クラスReader
n
- スキップする文字数IOException
- ストリームが閉じられている場合、または入出力エラーが発生した場合public boolean ready() throws IOException
ready
、クラスReader
IOException
- 入出力エラーが発生した場合public boolean markSupported()
markSupported
、クラスReader
public void mark(int readAheadLimit) throws IOException
mark
、クラスReader
readAheadLimit
- マークを保持しながら読み込むことができる文字数の上限。 ストリームには文字配列から入力されるので、実際の上限はない。そのため、この引数は無視される。 IOException
- 入出力エラーが発生した場合public void reset() throws IOException
reset
、クラスReader
IOException
- 入出力エラーが発生した場合 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。