- Java.io 包类
- Java.io - 首页
- Java.io - BufferedInputStream
- Java.io - BufferedOutputStream
- Java.io - BufferedReader
- Java.io - BufferedWriter
- Java.io - ByteArrayInputStream
- Java.io - ByteArrayOutputStream
- Java.io - CharArrayReader
- Java.io - CharArrayWriter
- Java.io - Console
- Java.io - DataInputStream
- Java.io - DataOutputStream
- Java.io - File
- Java.io - FileDescriptor
- Java.io - FileInputStream
- Java.io - FileOutputStream
- Java.io - FilePermission
- Java.io - FileReader
- Java.io - FileWriter
- Java.io - FilterInputStream
- Java.io - FilterOutputStream
- Java.io - FilterReader
- Java.io - FilterWriter
- Java.io - InputStream
- Java.io - InputStreamReader
- Java.io - LineNumberInputStream
- Java.io - LineNumberReader
- Java.io - ObjectInputStream
- Java.io - ObjectInputStream.GetField
- Java.io - ObjectOutputStream
- io - ObjectOutputStream.PutField
- Java.io - ObjectStreamClass
- Java.io - ObjectStreamField
- Java.io - OutputStream
- Java.io - OutputStreamWriter
- Java.io - PipedInputStream
- Java.io - PipedOutputStream
- Java.io - PipedReader
- Java.io - PipedWriter
- Java.io - PrintStream
- Java.io - PrintWriter
- Java.io - PushbackInputStream
- Java.io - PushbackReader
- Java.io - RandomAccessFile
- Java.io - Reader
- Java.io - SequenceInputStream
- Java.io - SerializablePermission
- Java.io - StreamTokenizer
- Java.io - StringBufferInputStream
- Java.io - StringReader
- Java.io - StringWriter
- Java.io - Writer
- Java.io 包附加内容
- Java.io - 接口
- Java.io - 异常
- Java.io 包有用资源
- Java.io - 讨论
Java.io.CharArrayReader.markSupported() 方法
描述
java.io.CharArrayReader.markSupported() 方法测试流是否支持 mark()。字符数组读取器支持 mark() 方法。
声明
以下是 java.io.CharArrayReader.markSupported() 方法的声明:
public boolean markSupported()
参数
无
返回值
如果流支持 mark() 调用,则该方法返回 true。
异常
无
示例
以下示例演示了 java.io.CharArrayReader.markSupported() 方法的使用。
package com.tutorialspoint; import java.io.CharArrayReader; import java.io.IOException; public class CharArrayReaderDemo { public static void main(String[] args) { CharArrayReader car = null; char[] ch = {'A', 'B', 'C', 'D', 'E'}; try { // create new character array reader car = new CharArrayReader(ch); // verifies if the stream support mark() method boolean bool = car.markSupported(); System.out.println("Is mark supported : "+bool); System.out.println("Proof:"); // read and print the characters from the stream System.out.println(car.read()); System.out.println(car.read()); // mark() is invoked at this position car.mark(0); System.out.println("Mark() is invoked"); System.out.println(car.read()); System.out.println(car.read()); // reset() is invoked at this position car.reset(); System.out.println("Reset() is invoked"); System.out.println(car.read()); System.out.println(car.read()); System.out.println(car.read()); } catch(IOException e) { // if I/O error occurs e.printStackTrace(); } finally { // releases any system resources associated with the stream if(car!=null) car.close(); } } }
让我们编译并运行上面的程序,这将产生以下结果:
Is mark supported : true Proof: 65 66 Mark() is invoked 67 68 Reset() is invoked 67 68 69
java_io_chararrayreader.htm
广告