commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@apache.org>
Subject Re: [VFS] OutOfMemory Exception on large files
Date Wed, 08 Jun 2005 17:11:37 GMT
>> We are using HTTP protocol. We have code something like this (in a
>> simple junit test):-
> 
> Neither "http" nor "url" supports output streams, so I guess your target
> URL is a "webdav://" resource, isnt it?

We can even reproduce it with the "file:" protocol!

 final String sourceURI = "file:/Users/tcurdt/90MB";
 final String targetURI = "file:/Users/tcurdt/test";

 final FileSystemManager fsManager = VFS.getManager();

 final FileObject toDownload = fsManager.resolveFile(sourceURI);
 final InputStream is = toDownload.getContent().getInputStream();

 final FileObject toUpload = fsManager.resolveFile(targetURI);
 final OutputStream os = toUpload.getContent().getOutputStream();

 org.apache.commons.io.IOUtils.copy(is, os);

 os.close();
 is.close();

> webdav buffers the output until close and send the whole stuff at once.

Uh!

> Maybe it is possible to use Piped-Streams to pass through to the webdav
> server, but currently I do not have enough spare time to do this -
> contributions are welcome :-)

Can you point me into the right direction ...haven't had
a closer look into the vfs codebase yet.

> As a workaround you could add "-Xmx512m" (or what ever fits your needs)
> to your JVM startup to allow java to allocate more memory.

...naaa ...that's not even a workaround
we are talking about biiiiiig files! :-)

cheers
--
Torsten

Mime
View raw message