/* (non-Javadoc)
@see com.abubusoft.kripton.AbstractContext#createParser(java.io.InputStream)
353854
public XmlWrapperParser createParser(InputStream inputStream) {
        try {
			return new XmlWrapperParser(this, inputStream, getSupportedFormat());
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}
	}
965384
public synchronized Node parse(InputStream in) throws IOException,SAXException
    {
        Handler handler=new Handler();
        XMLReader reader=_parser.getXMLReader();
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.setEntityResolver(handler);
        _parser.parse(new InputSource(in),handler);
        if(handler._error!=null)
            throw handler._error;
        Node doc=(Node)handler._top.get(0);
        handler.clear();
        return doc;
    }
911506
@SuppressWarnings("resource")
    @Override
    public HoconTreeTraversingParser createParser(String content)
        throws IOException, JsonParseException
    {
        Reader r = new StringReader(content);
        IOContext ctxt = _createContext(r, true); // true->own, can close
        // [JACKSON-512]: allow wrapping with InputDecorator
        if (_inputDecorator != null) {
            r = _inputDecorator.decorate(ctxt, r);
        }
        return _createParser(r, ctxt);
    }
1362395
public XmlWrapperParser createParser(String content) {		
        try {
        	ByteArrayInputStream inputStream = new ByteArrayInputStream(content.getBytes(JsonEncoding.UTF8.toString()));
			return new XmlWrapperParser(this, inputStream, getSupportedFormat());
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}
	}
303578
protected void parse(InputStream in) throws Exception {
        DefaultHandler handler = new StateConfigHandler();
        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
        saxFactory.setValidating(true);
        SAXParser parser = saxFactory.newSAXParser();
        parser.parse(in, handler);
    }
928784
public void createResource(final InputStream inputStream, final String resourceName)
        throws JaxRxException {
        synchronized (resourceName) {
            if (inputStream == null) {
                throw new JaxRxException(400, "Bad user request");
            } else {
                try {
                    shred(inputStream, resourceName);
                } catch (final TTException exce) {
                    throw new JaxRxException(exce);
                }
            }
        }
    }
814427
public void parse(InputStream in) throws IOException, ParseException {
		String input = new String(StreamSupport.absorbInputStream(in));
		parse(input);
	}
500641
function Parser(stream) {
  StreamStack.call(this, stream, {
    data: function(b) { this._onData(b); }
  });
  this._onData = this._parseHeader;
  this._headerParser = new HeaderParser(new Stream(), {
    emitFirstLine: false,
    strictCRLF: false,
    strictSpaceAfterColon: false,
    allowFoldedHeaders: false
  });
  this._headerParser.on('headers', this._onHeadersComplete.bind(this));
}
754209
@Override
    public XMLStreamReader createXMLStreamReader(InputStream in)
        throws XMLStreamException
    {
        // false for auto-close, since caller has access to the input stream
        return createSR(null, in, null, false, false);
    }
447569
public final void addParser(@NotNull final ParserConfig parser) {
        Contract.requireArgNotNull("parser", parser);
        if (parsers == null) {
            parsers = new Parsers();
        }
        parsers.addParser(parser);
    }
1367581
protected BufferedInputStream buffer(final InputStream inputStream) {
        // reject null early on rather than waiting for IO operation to fail
        if (inputStream == null) { // not checked by BufferedInputStream
            throw new NullPointerException("inputStream == null");
        }
        return inputStream instanceof BufferedInputStream ? (BufferedInputStream) inputStream
                : new BufferedInputStream(inputStream);
    }
394528
public static <MSG extends Message> CloseableIterator<MSG> readStream(File file, Parser<MSG> parser) {
    try {
      // the input stream is closed by the CloseableIterator
      BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
      return readStream(input, parser);
    } catch (Exception e) {
      throw ContextException.of("Unable to read messages", e).addContext("file", file);
    }
  }
544220
public static Reader createReader(InputStream inputStream,String encoding)
    {
        //get encoding
        String updatedEncoding=IOHelper.getEncodingToUse(encoding);
        
        //create reader
        Reader reader=null;
        try
        {
            reader=new InputStreamReader(inputStream,updatedEncoding);
        }
        catch(UnsupportedEncodingException exception)
        {
            throw new FaxException("Unable to create reader, unsupported encoding: "+encoding,exception);
        }
        
        return reader;
    }
259616
public static <T> SNAXParser<T> createParser(XMLInputFactory factory, NodeModel<T> model) {
        return new SNAXParser<T>(factory, model);
    }
826194
public T parse(InputStream inputStream) {
        Reader inputStreamReader = new InputStreamReader(inputStream);
        Reader streamReader = new BufferedReader(inputStreamReader);

        // Parse result type from the returned JSON
        return gson.fromJson(streamReader, type.getType());
    }
1161606
@Override
    public Parser newFixedLengthParser(final InputStream pzmapXMLStream, final InputStream dataSourceStream) {
        return new BuffReaderFixedParser(pzmapXMLStream, dataSourceStream);
    }
1094053
public Object parse(InputStream inputStream, String charset) {
        if (inputStream == null) {
            throw new IllegalArgumentException("inputStream must not be null");
        }
        if (charset == null) {
            throw new IllegalArgumentException("charset must not be null");
        }

        Object content;
        content = createParser().parse(inputStream, charset);
        return content;
    }