Yes, and for the record.  Don't presume that you should *always* use
buffering in any given situation.  Buffering can actually hurt your
performance depending on the use-case.  In other situations, buffering is
completely inappropriate.  Too many people blindly just start using
BufferedReader/Writer or BufferedStreams.... almost like it is a magic
racing stripe that will make their car go faster.

There is a reason why (good) engineers only generally expose low-level
unbuffered streams in their APIs.  They leave it to the user to determine
for themselves whether or not to wrap them in a buffer on not -- depending
on the use case.  It is definitely the safest and most appropriate thing to
do.

-- Rick



On Fri, Jul 30, 2010 at 1:35 PM, Daniil Sosonkin <dan...@orbisfn.com> wrote:

>  LOL, Nikolaos, you're obsessed with buffering. Seems the problem for this
> guy is in the servlet container.
>
> Nikolaos Giannopoulos wrote:
>
> Daniil Sosonkin wrote:
>
> Somewhere down the line, there is too much buffering going on.
>
> ASIDE:  Your quite right and evidently there isn't "any" buffering where it
> needs to be... around the FileInputStream... ;-)
>
> Oh well... I guess if something isn't built in people won't probably use it
> as is case time and time again with InputStreams and Buffering... .
>
> --Nikolaos
>
>  I've written a video download ActionBean some years ago; it was sending
> 100MB files with no problems. The code is below and is identical to yours.
> How much memory to give to your application engine?
>
>                 return new StreamingResolution("application/octet-stream")
> {
>                     protected void stream(HttpServletResponse response)
> throws Exception
>                         {
>                             String sp = File.separator;
>                             InputStream in = new
> FileInputStream(video.getLocation() + sp + video.getFilename());
>                             try
>                                 {
>                                     OutputStream out =
> response.getOutputStream();
>
>                                     byte[] buf = new byte[1024 * 65];
>                                     int size = 0;
>
>                                     while ((size = in.read(buf)) > 0)
>                                         out.write(buf, 0, size);
>                                 }
>                             finally
>                                 {
>                                     in.close();
>                                 }
>                         }
>                 }.setFilename(video.getOriginalFilename());
>             }
>
>
> Daniil
>
>
> ------------------------------
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more 
> details:http://p.sf.net/sfu/dev2dev-palm
>
> ------------------------------
>
> _______________________________________________
> Stripes-users mailing 
> liststripes-us...@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to