configures this loader with a stream

@param is stream used to read the configuration
@throws IOException if reading or parsing the contents of the stream fails
7026
public void configure(InputStream is) throws IOException {
        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();
                int index = params.indexOf('=');
                if (index == -1) {
                    throw new IOException("unexpected property format - expecting name=value" + lineNumber + " : " + line);
                }
                String propName = params.substring(0, index);
                String propValue = assignProperties(params.substring(index + 1));
                System.setProperty(propName, propValue);
            } else {
                throw new IOException("unexpected line in " + lineNumber + " : " + line);
            }
        }

        if (requireMain && main == null) throw new IOException("missing main class definition in config file");
    }
234936
public void init(InputStream is, OutputStream os)
  {
    _is = is;
    _os = os;
    _needsFlush = false;
  }
7099
@SuppressWarnings("unchecked")
    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        stream.defaultReadObject();
        this.properties = (Map<Object, Object>) stream.readObject();
    }
980266
public void parse(InputStream is) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(
				(InputStream) is,ByteOp.UTF8));
        String read;
        boolean allowRuleFound = false;
        // true if curr or last line read was a User-agent line 
        boolean currLineUA = false; 
        boolean lastLineUA = false;
        ArrayList<String> current = null;
        while (br != null) {
            lastLineUA = currLineUA;
            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 {
                currLineUA = false;
                int commentIndex = read.indexOf("#");
                if (commentIndex > -1) {
                    // Strip trailing comment
                    read = read.substring(0, commentIndex);
                }
                read = read.trim();
                Matcher uaMatcher = USER_AGENT_PATTERN.matcher(read);
                if (uaMatcher.matches()) {
                    String ua = uaMatcher.group(1).trim().toLowerCase();
                    if (current == null || current.size() != 0 || allowRuleFound || !lastLineUA) {
                        // only create new rules-list if necessary
                        // otherwise share with previous user-agent
                        current = new ArrayList<String>();
                    }
                    rules.put(ua, current);
                    allowRuleFound = false;
                    currLineUA = true;
                    LOGGER.fine("Found User-agent(" + ua + ") rules...");
                    continue;
                }
                Matcher disallowMatcher = DISALLOW_PATTERN.matcher(read);
                if (disallowMatcher.matches()) {
                	if (current == null) {
                        // buggy robots.txt
                    	bSyntaxErrors = true;
                        continue;
                    }
                    String path = disallowMatcher.group(1).trim();
					// Disallow: without path is just ignored.
					if (!path.isEmpty())
                    current.add(path);
                    continue;
                }
                Matcher allowMatcher = ALLOW_PATTERN.matcher(read);
                if (allowMatcher.matches()) {
                	// Mark that there was an allow rule to clear the current list for next user-agent
                	allowRuleFound = true;
                }
                // unknown line; do nothing for now
                
                // TODO: check for "Allow" lines, and flag a syntax error if 
                //       we encounter any unknown lines?
            }
        }
    }
878652
public static Map<String, Object> read(InputStream stream)
		throws IOException
	{
		ConfigJsonInput input = new ConfigJsonInput(new InputStreamReader(stream, StandardCharsets.UTF_8));
		return read(input);
	}
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);
            }
        }
1274197
public boolean read(InputStream stream) throws IOException
    {
        valid = false;
        InputStreamReader reader = new InputStreamReader(stream);

        // Load the file contents
        contents = getContents(reader, "\n");
        if(contents != null)
            valid = true;
        else
            logger.severe("Unable to read file contents: "+filename);

        try
        {
            if(reader != null)
                reader.close();
        }
        catch(IOException e)
        {
        }

        return valid;
    }
270703
public static JsonAsserter with(InputStream is) throws IOException {
        Reader reader = new InputStreamReader(is);
        return with(reader);
    }
1251108
public static Serializable loadConfig (InputStream source)
        throws IOException
    {
        try {
            ObjectInputStream oin = new ObjectInputStream(source);
            return (Serializable)oin.readObject();
        } catch (ClassNotFoundException cnfe) {
            String errmsg = "Unknown config class";
            throw (IOException) new IOException(errmsg).initCause(cnfe);
        }
    }
836156
public void read(InputStream is) throws IOException {
        // Buffered input stream for reading manifest data
        FastInputStream fis = new FastInputStream(is);
        // Line buffer
        byte[] lbuf = new byte[512];
        // Read the main attributes for the manifest
        attr.read(fis, lbuf);
        // Total number of entries, attributes read
        int ecount = 0, acount = 0;
        // Average size of entry attributes
        int asize = 2;
        // Now parse the manifest entries
        int len;
        String name = null;
        boolean skipEmptyLines = true;
        byte[] lastline = null;

        while ((len = fis.readLine(lbuf)) != -1) {
            if (lbuf[--len] != '\n') {
                throw new IOException("manifest line too long");
            }
            if (len > 0 && lbuf[len-1] == '\r') {
                --len;
            }
            if (len == 0 && skipEmptyLines) {
                continue;
            }
            skipEmptyLines = false;

            if (name == null) {
                name = parseName(lbuf, len);
                if (name == null) {
                    throw new IOException("invalid manifest format");
                }
                if (fis.peek() == ' ') {
                    // name is wrapped
                    lastline = new byte[len - 6];
                    System.arraycopy(lbuf, 6, lastline, 0, len - 6);
                    continue;
                }
            } else {
                // continuation line
                byte[] buf = new byte[lastline.length + len - 1];
                System.arraycopy(lastline, 0, buf, 0, lastline.length);
                System.arraycopy(lbuf, 1, buf, lastline.length, len - 1);
                if (fis.peek() == ' ') {
                    // name is wrapped
                    lastline = buf;
                    continue;
                }
                name = new String(buf, 0, buf.length, "UTF8");
                lastline = null;
            }
            Attributes attr = getAttributes(name);
            if (attr == null) {
                attr = new Attributes(asize);
                entries.put(name, attr);
            }
            attr.read(fis, lbuf);
            ecount++;
            acount += attr.size();
            //XXX: Fix for when the average is 0. When it is 0,
            // you get an Attributes object with an initial
            // capacity of 0, which tickles a bug in HashMap.
            asize = Math.max(2, acount / ecount);

            name = null;
            skipEmptyLines = true;
        }
    }
6864
private void streamContent(HttpServletResponse response, InputStream is) throws IOException {

        OutputStream os = response.getOutputStream();
        try {
            byte buffer[] = new byte[DEFAULT_BUFFER_SIZE];
            int bytes;
            while ((bytes = is.read(buffer)) >= 0) {
                os.write(buffer, 0, bytes);
            }
        } finally {
            os.close();
        }
    }
250041
public T parse(InputStream is) throws IOException {
        JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(is);
        jsonParser.nextToken();
        return parse(jsonParser);
    }
1020978
public void saveWithTrainingConfig(OutputStream outputStream) throws IOException {
        if(this.trainingConfig == null) {
            throw new IllegalStateException("No training configuration found!");
        }

        saveWithTrainingConfig(this.trainingConfig,outputStream);
    }
76454
public static void copy(InputStream is, File file) throws IOException {

		Asserts.notNullParameter("is", is);
		Asserts.notNullParameter("file", file);
		
		FileOutputStream os = null;
		os = new FileOutputStream(file);
		copy(is, os);
	}
921248
public static String streamToString(final InputStream is) throws IOException {
        final StringBuffer sb = new StringBuffer();
        final BufferedReader in = new BufferedReader(new InputStreamReader(is));
        String line;
        while ((line = in.readLine()) != null) {
            sb.append(line);
            sb.append(LS);
        }
        return sb.toString();
    }
217280
public void load(final InputStream is, final String encoding) throws IOException {
		load(new InputStreamReader(is, encoding));
	}
1125542
private void readFile(InputStream is) throws IOException
   {
      StreamHelper.skip(is, 64);
      int index = 64;

      ArrayList<Integer> offsetList = new ArrayList<Integer>();
      List<String> nameList = new ArrayList<String>();

      while (true)
      {
         byte[] table = new byte[32];
         is.read(table);
         index += 32;

         int offset = PEPUtility.getInt(table, 0);
         offsetList.add(Integer.valueOf(offset));
         if (offset == 0)
         {
            break;
         }

         nameList.add(PEPUtility.getString(table, 5).toUpperCase());
      }

      StreamHelper.skip(is, offsetList.get(0).intValue() - index);

      for (int offsetIndex = 1; offsetIndex < offsetList.size() - 1; offsetIndex++)
      {
         String name = nameList.get(offsetIndex - 1);
         Class<? extends Table> tableClass = TABLE_CLASSES.get(name);
         if (tableClass == null)
         {
            tableClass = Table.class;
         }

         Table table;
         try
         {
            table = tableClass.newInstance();
         }

         catch (Exception ex)
         {
            throw new RuntimeException(ex);
         }

         m_tables.put(name, table);
         table.read(is);
      }
   }