*
The moose likes I/O and Streams and the fly likes How to upload a file of size >8GB ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to upload a file of size >8GB ?" Watch "How to upload a file of size >8GB ?" New topic
Author

How to upload a file of size >8GB ?

vinod perla
Greenhorn

Joined: Jan 06, 2005
Posts: 16
using InputStream I think it is not possible to upload a file which is greater than 2.14GB so, can anybody suggest me how to upload a file of size greater than 8GB?
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
I dont think that this is a kind of a mail -attachment...

whats the setup like?
vinod perla
Greenhorn

Joined: Jan 06, 2005
Posts: 16
I've to upload a file of size 8GB to a FTP server through a Java Application. Can anyone suggest any API/Any other way to handle it?
Pratik Patel
Greenhorn

Joined: Mar 20, 2007
Posts: 9
I think you should use NIO. Take the input Channel from file's InputStream and output channel from the Socket of Remote server.

Read and write the data from input buffer to output buffer.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8877
    
    8

Originally posted by vinod perla:
using InputStream I think it is not possible to upload a file which is greater than 2.14GB


There is no size limit on a stream. If there is any size limit, it is determined by the operating system or the file system and no amount of magic at the application level will get around it (see here for a comparison of file system capabilities).
Using NIO will not get around any limitation, if one exists. The stream-style classes are implemented using NIO (that's why there's a channel available in the InputStream). NIO still has to obey limits set by OS and file system parameters.
Have you tried to upload an 8GB file? If so, what errors did you see? What OS/file system is the destination system?
[ March 23, 2007: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by vinod perla:
I've to upload a file of size 8GB to a FTP server through a Java Application. Can anyone suggest any API/Any other way to handle it?


When we talk of bytestreams , then size really doesnot matter as streams are like byte pipes.You program might be failing because of lack of disk space at the other end.


Rahul Bhattacharjee
LinkedIn - Blog
vinod perla
Greenhorn

Joined: Jan 06, 2005
Posts: 16
Originally posted by Joe Ess: Have you tried to upload an 8GB file? If so, what errors did you see? What OS/file system is the destination system?


I've used Jakarta Commons Net 1.4.0 API and I tried uploading a file of size 8GB to a FTP server, after transferring 2.14GB I'm getting a CopyStreamException.

I tried uploading manually the same file through FTP PUT command it uploaded successfully.
vinod perla
Greenhorn

Joined: Jan 06, 2005
Posts: 16
Originally posted by Rahul Bhattacharjee:
When we talk of byte streams , then size really doesn't matter as streams are like byte pipes. You program might be failing because of lack of disk space at the other end.


There is enough disk space at FTP Server. When I tried uploading the same file through FTP PUT command it uploaded successfully.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8877
    
    8

Originally posted by vinod perla:


I've used Jakarta Commons Net 1.4.0 API and I tried uploading a file of size 8GB to a FTP server, after transferring 2.14GB I'm getting a CopyStreamException.

I tried uploading manually the same file through FTP PUT command it uploaded successfully.


CopyStreamException has a method, getIOException, which is documented as:
Returns the IOException responsible for the failure of a copy operation.

I think that would give valuable insight as to what is going on here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to upload a file of size >8GB ?