Java BufferedInputStream.markSupported()方法

2019-10-16 22:18:33

Java BufferedInputStream.markSupported()方法

BufferedInputStreamJava BufferedInputStream.markSupported()方法具有以下語法。

public boolean markSupported()

範例

在下面的程式碼中展示了如何使用Java BufferedInputStream.markSupported()方法。

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;

public class Main {
  public static void main(String[] args) throws Exception {

    boolean bool = false;

    InputStream inStream = new FileInputStream("c:/test.txt");

    // input stream is converted to buffered input stream
    BufferedInputStream bis = new BufferedInputStream(inStream);

    // returns true if mark() and read() supports
    bool = bis.markSupported();
    System.out.println("Support for mark() and reset() : " + bool);

  }
}