Java FilterInputStream markSupported() Example
FilterInputStream class markSupported() method example. This example shows you how to use markSupported() method.
Syntax is : public boolean markSupported()
Method tests if this input stream supports the mark and reset methods. This method simply performs in.markSupported().
Here is the code.
/**
* @(#) MarkSupportedFilterInputStream.java
* A class representing use of method markSupported() of FilterInputStream
class in java.io Package.
* @Version 09-June-2008
* @author Rose India Team
*/
import java.io.*;
public class MarkSupportedFilterInputStream extends FilterInputStream {
MarkSupportedFilterInputStream(InputStream objFin){
super(objFin);
}
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.
MarkSupportedFilterInputStream obj =new MarkSupportedFilterInputStream
(objInStream);
// markSupported() method call.
boolean bool = obj.markSupported();
System.out.println("This stream type supports the mark and reset "
+"methods........" + bool);
}
} |
Output of the program.
| This stream type supports the mark and reset methods........true |
|