SXC Advanced Java Project

User Generated

zvpunrynyyra

Computer Science

ST Xaviers College

Description

CPSC-4148/6648 NIO Assignment

Write a program named FileCopy that uses NIO to: • Split the attached file (concert0.mov) into three parts (concert1.mov, concert2.mov, and concert3.mov) • Create and store the three files in the folder C:\CPSC4148 (do not pre-create the folder). • then, rejoin the three files to produce a copy of concert0.mov named concert0(Copy).mov • “concert0(Copy).mov” should be placed in C:\CPSC4148. • “concert0.mov” should reside local to the program. • Subsequent runs of the program should work without the user having to delete the previously created folder and files. • The copy is successful when the copy is playable to the end.

Unformatted Attachment Preview

CPSC-4148/6648 NIO Assignment Write a program named FileCopy that uses NIO to: • Split the attached file (concert0.mov) into three parts (concert1.mov, concert2.mov, and concert3.mov) • Create and store the three files in the folder C:\CPSC4148 (do not pre-create the folder). • then, rejoin the three files to produce a copy of concert0.mov named concert0(Copy).mov • “concert0(Copy).mov” should be placed in C:\CPSC4148. • “concert0.mov” should reside local to the program. • Subsequent runs of the program should work without the user having to delete the previously created folder and files. • The copy is successful when the copy is playable to the end.
Purchase answer to see full attachment
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

Find attached the zipped Java file containing the solution. Ensure concert0.mov is at the root of the project folder. Let me know if you require the sample concert0.mov I used.

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.file.*;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;

/*
Adapted from tutorials in https://www.admios.com/blog/how-to-split-a-file-using-java
and https://stackoverflow.com/questions/25546750/merge-huge-files-without-loadingwhole-file-into-memory
and https://stackoverflow.com/questions/53146301/files-createdirectories-throwsfilealreadyexistsexceptions-but-no-directory
and https://www.logicbig.com/...

Similar Content

Related Tags