ByteArrayInputStream markSupported() in Java

markSupported(): This method is available in the java.io.ByteArrayInputStream class of Java.

Syntax:

boolean java.io.ByteArrayInputStream.markSupported()

This method tests if this InputStream supports mark/reset. The markSupported method of ByteArrayInputStreamalways returns true.

Parameters: NA

Returns: true if this stream instance supports the mark and reset methods; false otherwise.

Exceptions: NA

Approach

Java

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class ByteArrayInputStreammarkSupported {
    public static void main(String[] args) throws IOException {

        byte buf[] = { 1, 2, 3, 4 };
        ByteArrayInputStream byteArrayInputStream =
new ByteArrayInputStream(buf);

        System.out.println(byteArrayInputStream.markSupported());
        byteArrayInputStream.close();
    }

}

Output:

true


No comments:

Post a Comment