Parses provided {@link Reader} and returns typed result.

@param reader with content of bean to parse.
@return the new instance of bean.
@throws IOException allows IO exceptions.
179777
public T parse(Reader reader) throws IOException {
    T bean = createBean();
    populate(bean, reader);
    return bean;
  }
610715
public static boolean hasQObject(final Reader reader) throws IOException {
    final MetaObjectParser parser = new MetaObjectParser();
    parser.parse(reader);
    return parser.hasQObject;

  }
121350
protected Reader toReader(Object input) throws IOException {
        if (input instanceof Reader) {
            return (Reader) input;
        }

        if (input instanceof InputStream) {
            return new InputStreamReader((InputStream) input);
        }

        if (input instanceof String) {
            return new StringReader((String) input);
        }

        if (input instanceof URL) {
            return new InputStreamReader(((URL) input).openStream());
        }

        if (input instanceof File) {
            return new FileReader((File) input);
        }

        throw new IllegalArgumentException("Unable to turn " + input + " into reader");
    }
551056
public static Document parse(JsonReader reader) throws IOException, NotImplemented {
        reader.beginArray();
        int nodeType = reader.nextInt();


        CoreDocumentImpl doc = new DocumentImpl();

        if (nodeType == Node.ELEMENT_NODE) {
            addInitialElement(reader, doc);
        } else if (nodeType == Node.DOCUMENT_NODE) {
            addInitialDocNode(doc, reader);
        } else {
            throw new IllegalStateException("Don't know how to handle root node with type " + nodeType);
        }
        reader.endArray();
        return doc;
    }
781029
public void parse (Reader reader) {
		try {
			char[] data = new char[1024];
			int offset = 0;
			while (true) {
				int length = reader.read(data, offset, data.length - offset);
				if (length == -1) break;
				if (length == 0) {
					char[] newData = new char[data.length * 2];
					System.arraycopy(data, 0, newData, 0, data.length);
					data = newData;
				} else
					offset += length;
			}
			parse(data, 0, offset);
		} catch (IOException ex) {
			throw new SerializationException(ex);
		} finally {
			StreamUtils.closeQuietly(reader);
		}
	}
610263
public void add(Reader reader) throws IOException
    {
        BufferedReader buffered = new BufferedReader(reader);
        String line = buffered.readLine();
        while (line != null)
        {
            String[] split = line.split(delimiter);
            if (split.length != 2)
                throw new IllegalArgumentException();
            add(split[0].trim(), MentionType.getType(split[1].trim()));
            line = buffered.readLine();
        }
        // System.out.println("Size is now " + entities.size());
    }
657913
public void parseXml(Reader reader) throws IOException, XmlPullParserException {
    this.xmlPullParser.setInput(reader);
    Xml.parseElement(this.xmlPullParser, this, this.defaultNamespaceDictionary, null);
  }
1120116
public final static String process(final Reader reader, final Configuration configuration) throws IOException
    {
        final Processor p = new Processor(!(reader instanceof BufferedReader) ? new BufferedReader(reader) : reader,
                configuration);
        return p.process();
    }
1278830
public Object parse(Reader reader) {
        Object content;

        JsonLexer lexer = new JsonLexer(reader);

        JsonToken token = lexer.nextToken();
        if (token.getType() == OPEN_CURLY) {
            content = parseObject(lexer);
        } else if (token.getType() == OPEN_BRACKET) {
            content = parseArray(lexer);
        } else {
            throw new JsonException(
                    "A JSON payload should start with " + OPEN_CURLY.getLabel() +
                            " or " + OPEN_BRACKET.getLabel() + ".\n" +
                            "Instead, '" + token.getText() + "' was found " +
                            "on line: " + token.getStartLine() + ", " +
                            "column: " + token.getStartColumn()
            );
        }

        return content;
    }
626868
@GwtIncompatible("Reader")
  static CharInput asCharInput(final Reader reader) {
    checkNotNull(reader);
    return new CharInput() {
      @Override
      public int read() throws IOException {
        return reader.read();
      }

      @Override
      public void close() throws IOException {
        reader.close();
      }
    };
  }
396937
public JsonReader newJsonReader(Reader reader) {
    JsonReader jsonReader = new JsonReader(reader);
    jsonReader.setLenient(lenient);
    return jsonReader;
  }
98073
private static Object readValue(JsonReader reader) throws IOException {
    JsonToken token = reader.peek();
    switch (token) {
      case BEGIN_OBJECT:
        return readerToMap(reader);
      case BEGIN_ARRAY:
        return readerToList(reader);
      case BOOLEAN:
        return reader.nextBoolean();
      case NULL:
        reader.nextNull(); // consume the null token
        return null;
      case NUMBER:
        return reader.nextDouble();
      case STRING:
        return reader.nextString();
      default:
        throw new IllegalStateException("Invalid token " + token);
    }
  }
637274
public <T> T parse(Reader in, Class<T> mapTo) throws ParseException {
		return getPStream().parse(in, JSONValue.defaultReader.getMapper(mapTo));
	}
621326
public HalResource read(final Reader reader)
    {
        final ContentRepresentation readableRepresentation = representationFactory.readRepresentation(RepresentationFactory.HAL_JSON, reader);

        return new HalResource(objectMapper, readableRepresentation);
    }
533600
public static Parameters parse(Reader reader) throws AponParseException {
        if (reader == null) {
            throw new IllegalArgumentException("reader must not be null");
        }
        AponReader aponReader = new AponReader(reader);
        return aponReader.read();
    }
114966
public Reader create(Reader input, String configuration, String defaultConfiguration) throws IOException {
    if(defaultConfiguration==null) {
      defaultConfiguration = defaultArgument;
    }
    if (configs != null && configs.size() > 0) {
      if (configuration == null && defaultConfiguration == null) {
        throw new IOException("no (default)configuration");
      } else if (configuration == null) {
        if (configs.get(defaultConfiguration) != null) {
          return create(input, configs.get(defaultConfiguration));
        } else {
          throw new IOException(
              "default configuration " + defaultConfiguration + " not available");
        }
      } else {
        MtasConfiguration config = configs.get(configuration);
        if (config == null) {
          if (defaultConfiguration != null) {
            if (configs.get(defaultConfiguration) != null) {
              return create(input, configs.get(defaultConfiguration));
            } else {
              throw new IOException("configuration " + configuration
                  + " not found and default configuration " + defaultConfiguration
                  + " not available");
            }
          } else {
            throw new IOException("configuration " + configuration
                + " not available and no default configuration");
          }
        } else {
          return create(input, config);
        }
      }
    } else if (config != null) {
      return create(input, config);
    } else {
      throw new IOException("no configuration");
    }

  }
603230
public Reader getReader() throws IOException {
        if (stream != null) {
            Reader reader = new InputStreamReader(stream, configuration.getSourceEncoding());
            stream = null;
            return reader;
        }
        return null;
    }