Just call the method addStream( name_of_the_folder ):
   OutputStream os = zipStreamOutput.addStream( "zipfolder/
subfolder" );

Vaclav

On Oct 23, 7:32 pm, Bit Liner <[email protected]> wrote:
> How can i add a folder to the zipStreamOutput?
> I cannot write bytes that represents a folder, is there a way to do
> it?
>
> On Sep 16, 9:07 am, Vaclav Bartacek <[email protected]>
> wrote:
>
> > Look at ZipStreamOutput class 
> > from:http://code.google.com/p/audao/source/browse/#svn/trunk/modules/embed...
>
> > The usage in GAE or generally in servlets is as simple as following:
>
> > private void responseAsZipStream( HttpServletResponse response )
> > throws IOException {
> >         // prepare buffers:
> >         ByteArrayOutputStream bos = new ByteArrayOutputStream();
> >         ZipStreamOutput output = new ZipStreamOutput( bos );
>
> >         byte[] buf = new byte[4096];
>
> >         // now create the ZIP archive as you want:
> >         OutputStream os1 = output.addStream( "file1.txt" );
> >         // write to the output stream 1 , but do not close it -
> > ZipStreamOutput does it itself:
> >         os1.write( whatever );
> >         os1.flush();
> >         ....
> >         OutputStream os2 = output.addStream( "file2.txt" );
> >         // write to the output stream 2 , but do not close it -
> > ZipStreamOutput does it itself:
> >         os2.write( whatever );
> >         os2.flush();
> >         ....
>
> >         // finish the ZIP stream:
> >         output.finish();
>
> >         // now pass it as the HTTP response:
> >         byte[] data = bos.toByteArray();
>
> >         response.setContentType( "application/zip" );
> >         response.setContentLength( data.length );
> >         response.setHeader( "Content-Disposition", "inline; filename="
> > + "filename.zip");
> >         response.getOutputStream().write( data );
>
> > }
>
> > This works on gae - I use it at  audao.spoledge.com
>
> > Vaclav
>
> > On Sep 15, 3:19 am, Bit Liner <[email protected]> wrote:
>
> > > My app creates dinamically two files so that then the users can
> > > download these files in one zip file.
>
> > > But i have problem in implementing this operations.
>
> > > Some suggestion to help me?
> > > Library, if gae supports this operations, etc.
>
> > > (i have tried to use gaeVfs, but i have met problems: i cannot write
> > > the content of a file on the response, so i can download the file but
> > > its content is empty )

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to