This content has been marked as final. Show 8 replies
Can you pls advise how you made it to work?
I want to get a 3gp file (can it be treated as binary file?? ) from the remote server to a local machine. As per my understanding, it can be done in the steps as below:
1. open a URL connection to remote server
2. read the file in a byte array
3. write it to another file
(assuming that the mp4/3gp file can be treated like a zip file)
Can you please advise how can we read it in a byte array and write it to another file?
All "files" are binary data on a drive, CD, DVD, etc.
Reading anything as binary will give you thr RAW file, but no structure (file format), the format lies ontop of the file.
File formats like Zip, MP3, are just a way of looking at a file which can cause the underlying data to change, but will still be a stream of bits (binary data).
When reading it, you can get the whole file easily, but to recreate the data from the file, then, you'll need to understand the format and how that format changes data into bytes and bits.
The ZipInputStream suggestion isn't relevant if you are just trying to download a ZIP. ZipInputStream is for opening a ZIP file and seeing what's inside it.
All file downloads are the same, whether they're ZIP files, media, text, JARs, Web pages, ...:
int count; byte buffer = new byte; // or more ... while ((count = in.read(buffer)) > 0) out.write(buffer, 0, count);
Agree with what you are saying. But based on your experience/expertise, would you please advise as why is not able to read the 3gp file at all? why for the zip files it reads 52 bytes only? It works well with the text files. All the files are stored in the same location and the files are all OK.
Can it be related to the download permissions? Is it possible that it may be configured on the webserver (somewhere) so as not to give access to 3gp/zip files ??(and may be thats why I can't open it using the browser as well ??)