Java PushbackInputStream MarkSupported() Example
PushbackInputStream class MarkSupported() method example. This example shows you how to use MarkSupported() method.
Syntax is : public boolean markSupported()
This method tests if this input stream supports the mark and reset methods, which it does not.
Here is the code.
/**
* @(#) MarkSupportedPushbackInputStream.java
* A class representing use of method markSupported() of PushbackInputStream
class in java.io Package.
* @Version 10-June-2008
* @author Rose India Team
*/
import java.io.*;
public class MarkSupportedPushbackInputStream {
public static void main(String[] args) throws IOException {
byte[] byteArrayOut = new byte[]{'M', 'A', 'H', 'E', 'N', 'D', 'R','A'};
/* Create object of ByteArrayOutputStream class to write specified
byte array to the output byte stream. */
ByteArrayOutputStream objByteStream = new ByteArrayOutputStream();
objByteStream.write(byteArrayOut, 0, 8);
// Create object of ByteArrayInputStream class.
InputStream objInStream = new ByteArrayInputStream(byteArrayOut);
//Create object of MarkSupportedFilterInputStream class.
PushbackInputStream obj = new PushbackInputStream(objInStream);
// markSupported method call.
boolean bool = obj.markSupported();
System.out.println("This PushhbackInputStream is mark " +
"supported : " + bool);
}
} |
output of the program.
This PushhbackInputStream is mark supported : false
|
|