Re: NIO! Nein!
Chris Uppal wrote:
Never use available().
It doesn't do what most programmers think. If there are /any/ valid (safe and
correct) uses of it, I have yet to hear of them.
Never use available().
It's used by java.io.BufferedinputStream.read to see if fill any more of
its buffer without blocking.
For a brief time mustang had a peabody fix that tried harder to fill the
buffer. Unfortunately, for some streams available will often return 1.
If you try to read exactly the amount returned by available, that can
result in a vastly increased number of read (and available) calls,
killing performance.
Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.
Relevant Pages
- Re: Secure C library
... >> make buffer size decisions more visible, ... >> data about the commonest sources of bugs and security gaffes. ... any number of professional programmers over the past several decades. ... the proposer will come to meetings for a few years to shepherd ... (comp.std.c) - Re: [Lit.] Buffer overruns
... >> correctness of defective code. ... Consider a buffer you provide for DMA. ... >> there are address ranges that may be validly read and others that may ... > programmers for generating bad software quickly. ... (sci.crypt) - Re: [Lit.] Buffer overruns
... my experience is that programs written in C, except for buffer length ... frequently in C environments as in many other environments. ... null termination convention appeared to encourage programmers ... to believe that length was an attribute of the data pattern ... (sci.crypt) - Re: C++ Bounds Checking
... Giles wrote: ... It seems that some C programmers ... a pointer to the beginning of a buffer without also passing the length, ... no deficiencies and the other way is to make it so complicated ... (comp.lang.fortran) - Re: What is the buffer?
... of railroads to stop trains leaving the track, given that the train wasn't moving to fast. ... Such a buffer stop the information stored in it's items from beeing needed ... The pupose to store the complete numeric base10 representation of sqrtcan't be stored in a buffer, if I remember correctly, since programmers only have technical memory to dedicate. ... (microsoft.public.win32.programmer.directx.graphics) |
|