• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to clip the file in java ??

 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,
Is there any way we can clip any file (viz audio,video,text) as per the user specific requirments. I mean if the total file size is of 10 MB and I want to clip the file in such a way that I will get 3 different files of sizes 3 MB , 3MB and 4 MB . Is it possible to achive this . What are those API through which I can play around with files.
Any link ,white paper will be appriciated
Regards
Samir
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the starting page for Sun's tutorial on Java IO.

Note that although it is easy to manipulate binary files with the java.io package classes, you can't arbitrarily cut image and audio files and still maintain the header information that tells applications how to treat them.

Bill
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot William
So in short there is no way we can randomly cut the files ...is that so ???
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you can if it's only for splitting so they fit on a floppy or something.

As soon as you're cutting movie or music files, then you have to do a lot more then just copying part of the source file.
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Rob,
yess....I am aware of the fact that lot of things needs to be done when we clip the file ....especially with the header portion .....
Do you know the specific API or package in java which id dedicated for the same.
Any white paper , link will be appreciated
Thanks and regards
Samir
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since each file format will have its own unique properties, your best bet would be to search for a specific file format to find utilities that can be used to manipulate it.
Several image formats can be read and written by javax.imageio and resizing can be done with the standard Java API (again, search is your friend)
You could always use Runtime.exec() to spawn off external processes. In the Linux world we have some very useful utilities like lame, mplayer and imagemagick
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Joe for your kind help

Regards
Samir
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!