Is there any possible way to create FileInputStream
with mark supported feature as true
?
mark(int readlimit) method marks the current position in this input stream. A subsequent invocation to the reset() method reposition the stream to the recently marked position.
FileInputStream is Byte Based, it can be used to read bytes. FileReader is Character Based, it can be used to read characters. FileInputStream is used for reading binary files. FileReader is used for reading text files in platform default encoding.
Yes, you need to close the inputstream if you want your system resources released back. FileInputStream. close() is what you need.
The mark() method of BufferedInputStream class in Java is used to mark the current position in the input stream. Reset() method of the same class BufferedInputStream is called after the mark() method. Reset() fixes the position at the last marked position so that same byte can be read again.
Wrap your Fileinputstream inside a BufferedInputStream.
The buffered streams support marks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With