Returns InputReader for input
@param <T>
@param input Any supported input type
@param size Ring-buffer size
@param features Needed features
@return
@throws IOException
975187
public static <T> InputReader getInstance(T input, int size, Set<ParserFeature> features) throws IOException
    {
        return getInstance(input, size, UTF_8, features);
    }
191898
private static String readLineFromReaderWithMark(final Reader input)
            throws IOException {
        char[] cbuf = new char[charBufferSize];
        try {
            input.mark(charBufferSize);
        } catch (IOException e) {
            // this should never happen
            LOG.warning("Caught exception setting mark on supporting reader: " + e);
            // fallback
            return readLineFromReaderWithoutMark(input);
        }

        // could be changed into do..while, but then
        // we might create an additional StringBuilder
        // instance at the end of the stream
        int count = input.read(cbuf);
        if (count == EOF) // we are at the end of the input data
            return null;

        StringBuilder line = new StringBuilder(expectedLineLength);
        // now work on the buffer(s)
        int ls = lineSeparatorIndex(cbuf, count);
        while (ls == -1) {
            line.append(cbuf, 0, count);
            count = input.read(cbuf);
            if (count == EOF) {
                // we are at the end of the input data
                return line.toString();
            }
            ls = lineSeparatorIndex(cbuf, count);
        }
        line.append(cbuf, 0, ls);

        // correct ls if we have \r\n
        int skipLS = 1;
        if (ls + 1 < count) {
            // we are not at the end of the buffer
            if (cbuf[ls] == '\r' && cbuf[ls + 1] == '\n') {
                skipLS++;
            }
        } else {
            if (cbuf[ls] == '\r' && input.read() == '\n') {
                skipLS++;
            }
        }

        //reset() and skip over last linesep
        input.reset();
        input.skip(line.length() + skipLS);
        return line.toString();
    }
713021
private void initialize(InputStream input) {
		BufferedReader reader = null;

		try {
			reader = new BufferedReader(new InputStreamReader(input));

			String line;

			Matcher m;

			while ((line = reader.readLine()) != null) {
				m = TYPE_PATTERN.matcher(line);

				if (m.find()) {
					String type = m.group(1);
					String[] extensions = m.group(2).split(" ");

					for (String extension : extensions) {
						contentTypes.put(extension, type);
					}
				}
			}
		} catch (IOException e) {
			// Unable to load
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
582335
private static Map<String, Object> readMap(StreamingInput input)
		throws IOException
	{
		boolean readEnd = false;
		if(input.peek() == Token.OBJECT_START)
		{
			// Check if the object is wrapped
			readEnd = true;
			input.next();
		}

		Token t;
		Map<String, Object> result = new HashMap<String, Object>();
		while((t = input.peek()) != Token.OBJECT_END && t != null)
		{
			// Read the key
			input.next(Token.KEY);
			String key = input.getString();

			// Read the value
			Object value = readDynamic(input);

			result.put(key, value);
		}

		if(readEnd)
		{
			input.next(Token.OBJECT_END);
		}

		return result;
	}
112172
public void readFrom(final InputStream in) throws IOException {
        pointer = 0;
        size = 0;
        int n;
        do {
            n = in.read(buffer, size, buffer.length - size);
            if (n > 0) {
                size += n;
            }
            resizeIfNeeded();
        } while (n >= 0);
    }
1127574
public final static String process(final String input, final Configuration configuration)
    {
        try
        {
            return process(new StringReader(input), configuration);
        }
        catch (final IOException e)
        {
            // This _can never_ happen
            return null;
        }
    }
338538
public boolean isMatch(PushbackReader input, int size) throws IOException
    {
        InputReader reader = Input.getInstance(input, size);
        return isMatch(reader);
    }
1081791
public String find(PushbackReader in, int size) throws IOException, SyntaxErrorException
    {
        if (acceptEmpty)
        {
            throw new IllegalArgumentException("using find for  '" + expression + "'  that accepts empty string");
        }
        InputReader reader = Input.getInstance(in, size);
        int rc = find(reader);
        reader.release();
        if (rc == 1)
        {
            return reader.getString();
        }
        else
        {
            throw new SyntaxErrorException("string matching  '" + expression + "'  not found");
        }
    }
1146034
public void setInput(final byte[] input)
	{

		if (input[0] == -128) {
			r = new BitReader(inflateInput(input, 1));
		}
		else {
			r = new BitReader(input);
		}
	}
1136626
public static List<String> readLines(InputStream input) throws IOException {
        final InputStreamReader reader = new InputStreamReader(input);
        return readLines(reader);
    }
725903
public static void skip(long size, InputStream input) throws IOException {
        while (size > 0) {
            size -= input.skip(size);
        }
    }
122296
public String getMatch(PushbackReader in, int size) throws IOException, SyntaxErrorException
    {
        InputReader reader = Input.getInstance(in, size);
        String s = getMatch(reader);
        reader.release();
        return s;
    }
224973
public String processInput(String input) {

        JsonObject object;
        try {
            object = gs.fromJson(input, JsonObject.class);
        } catch (Throwable t) {
            return "{ \"status\" : \"fail\", \"error\" : \"Failed to parse input\" }";
        }

        String command = object.get("command").getAsString();
        JsonObject payload;
        if (!object.has("payload")) {
            payload = new JsonObject();
        } else {
            payload = object.get("payload").getAsJsonObject();
        }

        CommandStatus status;

        try {
            status = dispatch(command, payload);
        } catch (Throwable t) {
            status = new CommandStatus();
            status.fail(t).setPayload(payload);
        }

        return status.toString();
    }
432813
public Reader create(Reader input, MtasConfiguration config)
      throws IOException {
    MtasFetchData fetchData = new MtasFetchData(input);
    if (config.attributes
        .containsKey(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE)) {
      if (config.attributes.get(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE)
          .equals(VALUE_TYPE_URL)) {
        try {
          return fetchData.getUrl(
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_PREFIX),
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_POSTFIX));
        } catch (MtasParserException e) {
          log.debug(e);
          throw new IOException(e.getMessage());
        }
      } else if (config.attributes
          .get(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE)
          .equals(VALUE_TYPE_FILE)) {
        try {
          return fetchData.getFile(
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_PREFIX),
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_POSTFIX));
        } catch (MtasParserException e) {
          throw new IOException(e);
        }
      } else {
        return fetchData.getDefault();
      }
    } else {
      return fetchData.getDefault();
    }
  }
781530
public static List<String> toLines(final Reader input) throws IOException {
		return CharStreams.readLines(toBufferedReader(input));
	}
501339
public static Properties load(InputStream input) throws IOException {
		Properties prop = new Properties();
		try {
			prop.load(input);
		} catch (IOException e) {
			throw new IOException("Failed to read properties from input");
		}
		return prop;
	}
173599
private static void displayTextInputStream(InputStream input) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(input));
        while (true) {
            String line = reader.readLine();
            if (line == null) break;

            System.out.println("    " + line);
        }
        System.out.println();
    }