PDA

View Full Version : Code to merge multiple files


madhu_24
02-22-2009, 05:26 PM
Hi, i've written a piece of code to download a large file from a http server in multiple parts, now i shud merge all of them to get back the original file in the same format(extension) can any1 suggest how i do that???

DELOCH
02-23-2009, 04:25 AM
if you know the order of the files, there is one stupid method to do that

String e = "";
e += [file part 1 data]
e += [file part 2 data]
e += [file part 3 data]
e += [file part 4 data]
...
e += [file part 1029323 data]

String fileName = "data.txt"
[save the e string onto fileName]

That's pretty abstract but it's not too difficult.
Try Scanner class for reading a file... Or bufferedreader