Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to add to the below code the abilty to limit the file size that will be read in. I will post the code

I need to add to the below code the abilty to limit the file size that will be read in. I will post the code that needs to be altered below.

public class Example {

/** * @param args the command line arguments */ public static void main(String[] args) { // Read the filename from the command line argument String filename = args[0]; BufferedReader inputStream = null;

String fileLine; try { inputStream = new BufferedReader(new FileReader(filename));

System.out.println("Email Addresses:"); // Read one Line using BufferedReader while ((fileLine = inputStream.readLine()) != null) { System.out.println(fileLine); } } catch (IOException io) { System.out.println("File IO exception" + io.getMessage()); } finally { // Need another catch for closing // the streams try { if (inputStream != null) { inputStream.close(); } } catch (IOException io) { System.out.println("Issue closing the Files" + io.getMessage()); }

} }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions