Read rules from InputStream argument into this RobotRules, as a
side-effect, sets the bSyntaxErrors property.

@param is
@throws IOException
768701
public void parse(InputStream is) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(
				(InputStream) is));
        String read;
        ArrayList<String> current = null;
        while (br != null) {
            do {
                read = br.readLine();
                // Skip comments & blanks
            } while ((read != null) && ((read = read.trim()).startsWith("#") ||
                read.length() == 0));
            if (read == null) {
            	br.close();
            	br = null;
            } else {
                int commentIndex = read.indexOf("#");
                if (commentIndex > -1) {
                    // Strip trailing comment
                    read = read.substring(0, commentIndex);
                }
                read = read.trim();
                if (read.matches("(?i)^User-agent:.*")) {
                    String ua = read.substring(11).trim().toLowerCase();
                    if (current == null || current.size() != 0) {
                        // only create new rules-list if necessary
                        // otherwise share with previous user-agent
                        current = new ArrayList<String>();
                    }
                    rules.put(ua, current);
                    LOGGER.fine("Found User-agent(" + ua + ") rules...");
                    continue;
                }
                if (read.matches("(?i)Disallow:.*")) {
                    if (current == null) {
                        // buggy robots.txt
                    	bSyntaxErrors = true;
                        continue;
                    }
                    String path = read.substring(9).trim();
                    current.add(path);
                    continue;
                }
                // unknown line; do nothing for now
                
                // TODO: check for "Allow" lines, and flag a syntax error if 
                //       we encounter any unknown lines?
            }
        }
    }
380364
public static int countLines(InputStream is) throws IOException {
        try {
            byte[] c = new byte[1024];
            int count = 0;
            int readChars = 0;
            boolean empty = true;
            while ((readChars = is.read(c)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (c[i] == '\n') {
                        ++count;
                    }
                }
            }
            return (count == 0 && !empty) ? 1 : count;
        } finally {
            is.close();
        }


    }
345007
public void readFrom(InputStream is) throws IOException {
        while(true) {
            if(count==buf.length) {
                // reallocate
                byte[] data = new byte[buf.length*2];
                System.arraycopy(buf,0,data,0,buf.length);
                buf = data;
            }

            int sz = is.read(buf,count,buf.length-count);
            if(sz<0)     return;
            count += sz;
        }
    }
1113174
private void checkForThreadErrors() throws IOException {
    if(error == true && childException != null) {
      error = false;
      IOException temp = childException;
      childException = null;
      throw temp;
    }
  }
36558
public static void skip(InputStream is) throws IOException {
        while (is.available() > 0) {
            is.skip(Long.MAX_VALUE);
        }
        is.close();
    }
1254869
protected int readInt(InputStream is) throws IOException
   {
      byte[] data = new byte[4];
      if (is.read(data) != data.length)
      {
         throw new EOFException();
      }

      return (MPPUtility.getInt(data, 0));
   }
1069612
public static void checkBamOrCramFile(InputStream is, String bamFileName) throws IOException {
        checkBamOrCramFile(is, bamFileName, true);
    }
60575
@Override
    public void parse(InputSource is, HandlerBase hb)
        throws SAXException, IOException
    {
        if (hb != null) {
            /* Ok: let's ONLY set if there are no explicit sets... not
             * extremely clear, but JDK tries to set them always so
             * let's at least do damage control.
             */
            if (mContentHandler == null) {
                setDocumentHandler(hb);
            }
            if (mEntityResolver == null) {
                setEntityResolver(hb);
            }
            if (mErrorHandler == null) {
                setErrorHandler(hb);
            }
            if (mDTDHandler == null) {
                setDTDHandler(hb);
            }
        }
        parse(is);
    }
1152151
private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException
   {
      for (SynchroTable table : tables)
      {
         if (REQUIRED_TABLES.contains(table.getName()))
         {
            readTable(is, table);
         }
      }
   }
143220
static public void skip(InputStream is, int size) throws IOException {
	    long n;
		while (size > 0) {
	        n = is.skip(size);
	        if (n <= 0)
	            break;
			size -= n;
		}
	}
222955
void readFrom(InputStream in) throws IOException {
		//TODO could optimize for aligned instances
		final int size = finish - start;
		final int length = (size + 7) >> 3;
		if (length == 0) return;
		int p = size & 7;
		final int q = finish - p;
		if (p != 0) performAdj(SET, q, (long) in.read(), p);
		p = q;
		while (p > start) {
			p -= 8;
			performAdj(SET, p, (long) in.read(), 8);
		}
	}
1046094
private void readObject(final java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException {
         try {
           field = (String) in.readObject();
           String patternString = (String) in.readObject();
           pattern = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE);
         } catch (PatternSyntaxException e) {
             throw new IOException("Invalid LIKE rule - " + e.getMessage());
         }
   }
292129
public void handleInputStream(final InputStream is) throws IOException
        {
        LOG.trace("Handling input stream.");
        final OutputStream os = new FileOutputStream(this.m_file);
        try
            {
            final long bytesWritten = org.littleshoot.util.IoUtils.copy(is, os, 
                this.m_writeListener);
            LOG.trace("Wrote "+bytesWritten+" to file: "+this.m_file);
            }
        finally
            {
            IOUtils.closeQuietly(is);
            IOUtils.closeQuietly(os);
            }
        }
517806
public static final byte[] readAllBytes(InputStream is) throws IOException
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buf = new byte[4096];
        int rc = is.read(buf);
        while (rc != -1)
        {
            baos.write(buf, 0, rc);
            rc = is.read(buf);
        }
        return baos.toByteArray();
    }
1240809
@SuppressWarnings("rawtypes")
    protected void validateInputStreamData(Map isd) throws IllegalStateException {
        String message = null;
        if (isd != null) {
            if (isd.size() <= 3) {
                boolean type = isd.containsKey(INPUT_STREAM_CONTENT_TYPE);
                boolean length = isd.containsKey(INPUT_STREAM_CONTENT_DATA_LENGTH);
                boolean data = isd.containsKey(INPUT_STREAM_CONTENT_DATA);
                if (type && length && data) {
                    // valid.
                    return;
                } else {
                    message = "One of required values of InputStreamData is missing. type : " + type + " length : " + length + " data : " + data;
                }
            } else {
                message = "InputStreamData contains an unrecognized item.";
            }
        } else {
            message = "InputStreamData is null.";
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
            logger.logp(Level.FINE, CLASS_NAME,"validateInputStreamData", message);
        throw new IllegalStateException(message);
    }
612471
public void configure(InputStream is) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
            int lineNumber = 0;

            while (true) {
                String line = reader.readLine();
                if (line == null) break;

                line = line.trim();
                lineNumber++;

                if (line.startsWith("#") || line.length() == 0) continue;

                if (line.startsWith(LOAD_PREFIX)) {
                    String loadPath = line.substring(LOAD_PREFIX.length()).trim();
                    loadPath = assignProperties(loadPath);
                    loadFilteredPath(loadPath);
                } else if (line.startsWith(GRAB_PREFIX)) {
                    String grabParams = line.substring(GRAB_PREFIX.length()).trim();
                    grabList.add(assignProperties(grabParams));
                } else if (line.startsWith(MAIN_PREFIX)) {
                    if (main != null)
                        throw new IOException("duplicate definition of main in line " + lineNumber + " : " + line);
                    main = line.substring(MAIN_PREFIX.length()).trim();
                } else if (line.startsWith(PROP_PREFIX)) {
                    String params = line.substring(PROP_PREFIX.length()).trim();
                    String key = SystemUtil.setSystemPropertyFrom(params);
                    System.setProperty(key, assignProperties(System.getProperty(key)));
                } else if (line.startsWith(CONFIGSCRIPT_PREFIX)) {
                    String script = line.substring(CONFIGSCRIPT_PREFIX.length()).trim();
                    configScripts.add(assignProperties(script));
                } else {
                    throw new IOException("unexpected line in " + lineNumber + " : " + line);
                }
            }
        }

        if (requireMain && main == null) throw new IOException("missing main class definition in config file");
        if (!configScripts.isEmpty()) {
            System.setProperty("groovy.starter.configscripts", DefaultGroovyMethods.join((Iterable)configScripts, ","));
        }
    }
351135
private static int read(InputStream is) throws IOException {
        int b = is.read();
        if (b == -1) {
            throw new EOFException();
        }
        return b;
    }