PartitionFile

User Generated

Cnhyn

Programming

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.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

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:
https://www.likeplum.com/questions/4472/java-write-a-method-partitionfile


Anonymous
Great! Studypool always delivers quality work.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags