new CharArrayReader(char[] buf, int offset, int length)
import java.io.CharArrayReader;
import java.io.IOException;
public class Main {
public static void main(String args[]) throws IOException {
String tmp = "abcdefghijklmnopqrstuvwxyz";
int length = tmp.length();
char c[] = new char[length];
tmp.getChars(0, length, c, 0);
CharArrayReader input1 = new CharArrayReader(c);
CharArrayReader input2 = new CharArrayReader(c, 0, 5);
int i;
while ((i = input1.read()) != -1) {
System.out.print((char) i);
}
while ((i = input2.read()) != -1) {
System.out.print((char) i);
}
}
}
Home
Java Book
File Stream
Java Book
File Stream
CharArrayReader:
- CharArrayReader
- new CharArrayReader(char[] buf, int offset, int length)