private int getChunkSize()
        throws IOException
    {
        if (_chunkSize<0)
            return -1;
        
        _trailer=null;
        _chunkSize=-1;
        
        // Get next non blank line
        org.openqa.jetty.util.LineInput.LineBuffer line_buffer
            =_in.readLineBuffer();
        while(line_buffer!=null && line_buffer.size==0)
            line_buffer=_in.readLineBuffer();
        
        // Handle early EOF or error in format
        if (line_buffer==null)
            throw new IOException("Unexpected EOF");
        
        String line= new String(line_buffer.buffer,0,line_buffer.size);
        
        
        // Get chunksize
        int i=line.indexOf(';');
        if (i>0)
            line=line.substring(0,i).trim();
        try
        {
            _chunkSize = Integer.parseInt(line,16);
        }
        catch (NumberFormatException e)
        {
            _chunkSize=-1;
            log.warn("Bad Chunk:"+line);
            log.debug(LogSupport.EXCEPTION,e);
            throw new IOException("Bad chunk size");
        }
                 
        // check for EOF
        if (_chunkSize==0)
        {
            _chunkSize=-1;
            // Look for trailers
            _trailer = new HttpFields();
            _trailer.read(_in);
        }
        
        return _chunkSize;
    }