code: private byte[] readBytes()
          throws IOException
      {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
  
          int c;
          boolean cr=false;
          boolean lf=false;
          
          // loop for all lines`
          while (true)
          {
              int b=0;
              while ((c=(_char!=-2)?_char:_in.read())!=-1)
              {
                  _char=-2;
  
                  // look for CR and/or LF
                  if (c==13 || c==10)
                  {
                      if (c==13) _char=_in.read();
                      break;
                  }
  
                  // look for boundary
                  if (b>=0 && b<_byteBoundary.length && c==_byteBoundary[b])
                      b++;
                  else
                  {
                      // this is not a boundary
                      if (cr) baos.write(13);
                      if (lf) baos.write(10);
                      cr=lf=false;
                      
                      if (b>0)
                          baos.write(_byteBoundary,0,b);
                      b=-1;
                    
                      baos.write(c);
                  }
              }
  
              // check partial boundary
              if ((b>0 && b<_byteBoundary.length-2) ||
                  (b==_byteBoundary.length-1))
              {
                  if (cr) baos.write(13);
                  if (lf) baos.write(10);
                  cr=lf=false;
                  baos.write(_byteBoundary,0,b);
                  b=-1;
              }
              
              // boundary match
              if (b>0 || c==-1)
              {
                  if (b==_byteBoundary.length)
                      _lastPart=true;
                  if (_char==10) _char=-2;
                  break;
              }
              
              // handle CR LF
              if (cr) baos.write(13);
              if (lf) baos.write(10);
              cr=(c==13);
              lf=(c==10 || _char==10);
              if (_char==10) _char=-2;  
          }
          if(log.isTraceEnabled())log.trace(baos.toString());
          return baos.toByteArray();
      }
docs: /* ------------------------------------------------------------