GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing www.geeksforgeeks.org — Java.io.InputStream Class in Java - GeeksforGeeks Java.io.InputStream Class in JavaLast Updated : 28 Mar, 2024 Java InputStream class is the superclass of all the io classes i.e. representing an input stream of bytes. It represents an input stream of bytes. Applications that are defining a subclass of the Java InputStream class must provide a method, that returns the next byte of input. A reset() method is invoked which re-positions the stream to the recently marked position.
Declaration of Java InputStream Classpublic abstract class InputStream Constructor of InputStream Class in JavaThere is a constructor used with InputStream is mentioned below:
Methods of Java InputStream Class
1. mark()Java.io.InputStream.mark(int arg) marks the current position of the input stream. It sets readlimit i.e. maximum number of bytes that can be read before mark position becomes invalid. Syntax :public void mark(int arg) 2. read()java.io.InputStream.read() reads next byte of data from the Input Stream. The value byte is returned in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. Syntax :public abstract int read() 3. close()java.io.InputStream.close() closes the input stream and releases system resources associated with this stream to Garbage Collector. Syntax :public void close() 4. read() :Java.io.InputStream.read(byte[] arg) reads number of bytes of arg.length from the input stream to the buffer array arg. The bytes read by read() method are returned as int. If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. Syntax : public int read(byte[] arg) 5. reset() :Java.io.InputStream.reset() is invoked by mark() method. It repositions the input stream to the marked position. Syntax :public void reset() 6. markSupported() :Java.io.InputStream.markSupported() method tests if this input stream supports the mark and reset methods. The markSupported method of InputStream returns false by default. Syntax :public boolean markSupported() 7. skip() :Java.io.InputStream.skip(long arg) skips and discards arg bytes in the input stream. Syntax :public long skip(long arg) Comment Explore | ||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |