code: protected int prepareOutput(int length)
          throws IOException
      {   
          if (_out==null)
              throw new IOException("closed");
          checkOutput();
          if (!_written)
          {
              _written=true;
              notify(OutputObserver.__FIRST_WRITE);
          }        
          
          if (_contentLength>=0)
          {
              if (_bytes+length>=_contentLength)
              {
                  length=_contentLength-_bytes;
                  if (length==0)
                      _nulled=true;
              }
          }
          _bytes+=length;
          return length;
      }
docs: /* ------------------------------------------------------------