Java FileReader markSupported() Method
Example
Check if a FileReader supports mark() and reset():
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
FileWriter myWriter = new FileWriter("filename.txt");
myWriter.write("Hello World");
myWriter.close();
FileReader myReader = new FileReader("filename.txt");
System.out.println(myReader.markSupported());
myReader.close();
}
}
Definition and Usage
The markSupported() method checks if the reader supports the mark() and reset() methods.
For a FileReader, it always returns false. Put the FileReader inside a BufferedReader when you need mark() and reset().
Tip: See the BufferedReader markSupported() method, which returns true.
Syntax
public boolean markSupported()
Parameter Values
None.
Technical Details
| Returns: | Always false for a FileReader. |
|---|
Related Pages
❮ FileReader Methods