Java FilterInputStream.markSupported()方法範例

2019-10-16 22:13:52

Java FilterInputStream.markSupported()方法範例

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

public boolean markSupported()

範例

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

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FilterInputStream;
import java.io.InputStream;
// from: w w W . y Ii B  A  I .c  OM
public class Main {
  public static void main(String[] args) throws Exception {

    boolean bool = false;

    // create input streams
    InputStream is = new FileInputStream("C://test.txt");
    FilterInputStream fis = new BufferedInputStream(is);

    // tests if the input stream supports mark() and reset()
    bool = fis.markSupported();

    // prints
    System.out.print("Supports mark and reset methods: " + bool);

  }
}