timer Asked: Jul 3rd, 2013
account_balance_wallet $5

Question Description

How do i write a method partitionFile which takes as input a String souce a String destination and an int n. Using the class MultiBufferedWriter( which i have written out already and it compiles) it should partition the source file into several files with the pattern destination + i for ranges of i to 1 until n.

Tutor Answer

School: UC Berkeley

This looks like exactly the same question that I answered for another asker just today!

Assuming that your MultiBufferedWriter class is the same then add this main method:

public static void main( String[] args) throws IOException{
String fileIn = "KhanakTheMagnificent";
new MultiBufferedWriter( fileIn, 3);

This constructs what is known as an anonymous object. The object exists because it was constructed but has no name and thus cannot be referenced later. It doesn't matter because it's only invocation of the constructor that is required.

Here's the link to where I had posted this earlier today so that you can see that other asker's class:

flag Report DMCA

Good stuff. Would use again.

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors