Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I join multiple files into one  RSS feed

 
komaravolu raju
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:I'll move this thread to our I/O forum.


here is the same issue with me..

I am writing a program for joining all the files (Only files) to a single file. The files may be of any file format either txt, doc, rtf, audio, video or any other.
The issue is that, I have written a code and it is working for many small and medium size files. when coming to the big sizes, it is throwing an exception,


Exception in thread "main" java.lang.IndexOutOfBoundsException
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(Unknown Source)
at java.io.DataInputStream.readFully(Unknown Source)
at com.vim.jy.MergeFile.<init>(MergeFile.java:128)
at com.vim.jy.MergeFile.main(MergeFile.java:150)



how to fix that.

here is the code :::::



MergeFile.java





I have also created a new thread on this.
your help and suggestions will be greatly appreciated....


[RP] added code tags [/RP]
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't hijack a thread for this unrelated issue while you already have your own thread for it. And I remember asking you to UseCodeTags last time.
 
komaravolu raju
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep. I am not trying to hijack this thread. moreover, I just want to covey my message to others so that they may give any possible fix for this or alternative.
and form next time, I wil use smart tags if I need to post some code..

I regret for the inconvenience.

Thanks for the advice.

 
Lester Burnham
Rancher
Posts: 1337
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
komaravolu raju wrote:I am not trying to hijack this thread.

Indeed, not any more. You were successful in actually doing it.
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed. Your post had nothing to do with performance but was about an error. I've added code tags for you, and I've already found the problem: rw_Buffer has a size of 999000, and you are using readFully which means you are trying to read 999000 bytes. The file probably doesn't have that many bytes.
 
komaravolu raju
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that because, (adding 999000) I wanna merge any kings of files. ie., audio, video or text .
when doing this on smaller size files, it works fine. If I use large size files, I am getting an exception.
As I am new to java, I could not identify the exception. moreover, according to the logic, it should not throw any exceptions or erors.
I got 3 exceptions.
>> Array index out of bounce exception.
>> some heap Heap Memory exception that is related to eclipse
>> access denied exception (access privileges are not imposed) on the file
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've now split the hijacked part into a separate thread of its own.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!