BufferedInputStream mark(int) in Java

mark(int): This method is available in java.io.BufferedInputStream class of Java.

Syntax:

void java.io.BufferedInputStream.mark(int readlimit)

This method takes one argument. This method sees the general contract of the mark method of InputStream.

Parameters: One parameter is required for this method.

readlimit: the maximum limit of bytes that can be read before the mark position becomes invalid.

Returns: NA

Exceptions: NA

Approach

Java

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;

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

        InputStream inputStream = InputStream.nullInputStream();
        BufferedInputStream bufferedInputStream =
new BufferedInputStream(inputStream);

        int readlimit = 1;
        bufferedInputStream.mark(readlimit);
        System.out.println(bufferedInputStream);
    }
}

Output:

java.io.BufferedInputStream@182decdb


No comments:

Post a Comment