[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn-javahl: streamFileContent and large files

From: Manuel Freiholz <m.freiholz_at_cadenas.de>
Date: 2006-02-07 12:06:23 CET

Hi Patrick,
here a short description:

I'm writting a svn-web-browser like ViewCVS.
I can view files and download files. When the user clicks download he
should get the file
directly. I don't want to save the file temporary on the server and send
it to the user.

Im using the "streamFileContent" in a Servlet but i got the problem that
i can not buffer the
way from the server to the user. Before i get the filled stream, i
already got a heap overflow.

I tried to write the OutputStream to the ServletOutputStream but.. same
error. (with large files)

Regards,
Manuel.

Patrick Mayweg wrote:

> Hi Manuel,
> I do not understand what kind of buffering you want to do. Could you
> explain that to me? If you do not want to use too much memory, a
> FileOutputStream would write the file content directly to the disk.
> Regards,
> Patrick
>
> Manuel Freiholz wrote:
>
>> Hi,
>> i just subscribed to this mailing list and i hope i write to the
>> correct adress.
>> I just started development with svn so be indulgent with me :P
>>
>> I'm not sure, but i think i found a bug in the new method of the
>> svn-javahl-1.3 -> "streamFileContent(..)". I looked in the native
>> code and found this ( File: SVNClient.cpp, Line 2405, Method:
>> streamFileContent ):
>>
>> ----
>> while (contentSize > 0)
>> {
>> size_t readSize = bufSize > contentSize ? contentSize : bufSize;
>> Err = svn_stream_read(read_stream, (char *)bufData, &readSize);
>> if (Err != NULL)
>> {
>> env->ReleaseByteArrayElements(buffer, bufData, 0);
>> svn_stream_close(read_stream);
>> JNIUtil::handleSVNError(Err);
>> return;
>> }
>>
>> env->ReleaseByteArrayElements(buffer, bufData, JNI_COMMIT);
>> env->CallVoidMethod(outputStream, writeMethod, buffer, 0,
>> readSize);
>> if (JNIUtil::isJavaExceptionThrown())
>> {
>> env->ReleaseByteArrayElements(buffer, bufData, 0);
>> svn_stream_close(read_stream);
>> return;
>> }
>> contentSize -= readSize;
>> }
>> ----
>>
>> The code is reading from the "read_stream" and fills the
>> OutputStream completly. -> No Buffering possible in my java.
>>
>> So i have the problem in my code that i can not download large files
>> like 80 MB and bigger directly via "streamFileContent" from subversion.
>>
>> Is there anybody with the same problem who knows a solutions?
>>
>> Greetings,
>> - Manuel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: dev-help@subversion.tigris.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 7 12:07:05 2006

This is an archived mail posted to the Subversion Dev mailing list.