Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ / Java program to demonstrate working of BufferedInputStream import java.io . BufferedInputStream; import java.io . FileInputStream; import java.io . IOException; / / Java program
Java program to demonstrate working of BufferedInputStream
import java.ioBufferedInputStream;
import java.ioFileInputStream;
import java.ioIOException;
Java program to demonstrate BufferedInputStream methods
class JavaAPI
public static void mainString args throws IOException
attach the file to FileInputStream
FileInputStream fin new FileInputStreamfiletxt;
BufferedInputStream bin new BufferedInputStreamfin;
illustrating available method
System.out.printlnNumber of remaining bytes:"
bin.available;
illustrating markSupported and mark method
boolean bbin.markSupported;
if b
bin.markbinavailable;
illustrating skip method
Original File content:
This is my first line
This is my second line
bin.skip;
System.out.printlnFileContents :;
read characters from FileInputStream and
write them
int ch;
while chbin.read
System.out.printcharch;
illustrating reset method
bin.reset;
while chbin.read
System.out.printcharch;
close the file
fin.close;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started