Home »
Java programming language
Java ByteArrayInputStream markSupported() Method with Example
ByteArrayInputStream Class markSupported() method: Here, we are going to learn about the markSupported() method of ByteArrayInputStream Class with its syntax and example.
Submitted by Preeti Jain, on March 02, 2020
ByteArrayInputStream Class markSupported() method
- markSupported() method is available in java.util package.
- markSupported() method is used to check whether this ByteArrayInputStream support mark() and reset() methods or not.
- markSupported() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
- markSupported() method does not throw an exception at the time of checking supportive methods.
Syntax:
public boolean markSupported();
Parameter(s):
- It does not accept any parameter.
Return value:
The return type of the method is boolean, it returns true when this stream support mark() and reset() method otherwise it returns false.
Example:
// Java program to demonstrate the example
// of boolean markSupported() method of
// ByteArrayInputStream
import java.io.*;
public class MarkSupportedBAIS {
public static void main(String[] args) throws Exception {
byte[] by = {
97,
98,
98,
99
};
// Instantiates ByteArrayInputStream
ByteArrayInputStream byte_s = new ByteArrayInputStream(by);
// By using markSupported() method check
// whether this stream byte_s support
// mark() and reset() or not
boolean status = byte_s.markSupported();
System.out.println("byte_s.markSupported(): " + status);
byte_s.close();
}
}
Output
byte_s.markSupported(): true