• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Splitting a .gz file into specified file sizes

 
manil manohar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This is my first posting, so not sure how apt my description of the issue is..

Below is a program I have written to split a .gz file into files based on the size of each file, the user wants. The parent .gz file is getting split, but not into the size as specified in the code.
For example, in the main I have said I want the parent file to be split into files of size 1 MB. But on executing the code, its getting split into n number of files of different sizes. Can someone help me pin point where I am going wrong? Any help would be great as I have run out of ideas..
 
Carey Brown
Ranch Hand
Posts: 1392
16
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use 'long' instead of 'double' for file sizes. Use BufferedInputStream and not DataInputStream & BufferedReader. You are calling fis.read() twice inside the while() loop.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic