/*
(non-Javadoc)

@see net.sf.flatpack.PZParserFactory#newParser(java.io.InputStream,
char, char)
345843
@Override
    public Parser newDelimitedParser(final InputStream dataSourceStream, final char delimiter, final char qualifier) {
        return new DelimiterParser(dataSourceStream, delimiter, qualifier, false);
    }
1174659
public Object parse(char [] chars) {
        if (chars == null) {
            throw new IllegalArgumentException("chars must not be null");
        }

        Object content;
        content = createParser().parse(chars);
        return content;
    }
57780
@Override
    public Parser newFixedLengthParser(final File pzmapXML, final File dataSource) {
        return new BuffReaderFixedParser(pzmapXML, dataSource);
    }
772014
static Parser<Expression> simpleNewExpression(Parser<Expression> arg, Parser<DefBody> body) {
    return Parsers.sequence(
        term("new").next(TypeLiteralParser.ELEMENT_TYPE_LITERAL),
        argumentList(arg),
        body.optional(),
        (type, args, defBody) -> new NewExpression(null, type, args, defBody));
  }
1156849
public TokenStream start() throws ParsingException {
        // Create the tokens ...
        if (tokens == null) {
            TokenFactory tokenFactory = caseSensitive ? new CaseSensitiveTokenFactory() : new CaseInsensitiveTokenFactory();
            CharacterStream characterStream = new CharacterArrayStream(inputContent);
            tokenizer.tokenize(characterStream, tokenFactory);
            this.tokens = initializeTokens(tokenFactory.getTokens());
        }

        // Create the iterator ...
        tokenIterator = this.tokens.listIterator();
        moveToNextToken();
        return this;
    }
579525
@Override
	public JacksonWrapperParser createParser(String content) {
		try {
			return new JacksonWrapperParser(innerFactory.createParser(content), getSupportedFormat());
		} catch (IOException e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}
	}
671636
public void expect(final char expectedChar) throws ParseException {
        final int next = getc();
        if (next != expectedChar) {
            throw new ParseException(this, "Expected '" + expectedChar + "'; got '" + (char) next + "'");
        }
    }
1043729
private JsonParserException createHelpfulException(char first, char[] expected, int failurePosition)
      throws JsonParserException {
    // Build the first part of the token
    StringBuilder errorToken = new StringBuilder(first
        + (expected == null ? "" : new String(expected, 0, failurePosition)));

    // Consume the whole pseudo-token to make a better error message
    while (isAsciiLetter(peekChar()) && errorToken.length() < 15)
      errorToken.append((char)advanceChar());

    return createParseException(null, "Unexpected token '" + errorToken + "'"
        + (expected == null ? "" : ". Did you mean '" + first + new String(expected) + "'?"), true);
  }
184738
public BufferedReader newBufferedReader(Path path, Charset cs)
    {
        try {
            return Files.newBufferedReader(path, cs);
        } catch (IOException e) {
            return null;
        }
    }
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;
    }
488447
static UTF8StreamJsonParser newJsonParser(InputStream in, byte[] buf,
            int offset, int limit, boolean bufferRecyclable, IOContext context)
            throws IOException
    {
        return new UTF8StreamJsonParser(context,
                DEFAULT_JSON_FACTORY.getParserFeatures(), in,
                DEFAULT_JSON_FACTORY.getCodec(),
                DEFAULT_JSON_FACTORY.getRootByteSymbols().makeChild(1),
                buf, offset, limit, bufferRecyclable);
    }
929530
public static Pipe newPipe(final JsonParser parser, boolean numeric) throws IOException
    {
        final JsonInput jsonInput = new JsonInput(parser, numeric);
        return new Pipe()
        {
            @Override
            protected Input begin(Pipe.Schema<?> pipeSchema) throws IOException
            {
                if (parser.nextToken() != JsonToken.START_OBJECT)
                {
                    throw new JsonInputException("Expected token: { but was " +
                            parser.getCurrentToken() + " on message " +
                            pipeSchema.wrappedSchema.messageFullName());
                }

                return jsonInput;
            }

            @Override
            protected void end(Pipe.Schema<?> pipeSchema, Input input,
                    boolean cleanupOnly) throws IOException
            {
                if (cleanupOnly)
                {
                    parser.close();
                    return;
                }

                assert input == jsonInput;
                final JsonToken token = parser.getCurrentToken();

                parser.close();

                if (token != JsonToken.END_OBJECT)
                {
                    throw new JsonInputException("Expected token: } but was " +
                            token + " on message " +
                            pipeSchema.wrappedSchema.messageFullName());
                }
            }
        };
    }
532599
public final void addParser(@NotNull final ParserConfig parser) {
        Contract.requireArgNotNull("parser", parser);
        if (list == null) {
            list = new ArrayList<>();
        }
        list.add(parser);
    }
661289
public static ContentType parse(
            final String s) throws ParseException, UnsupportedCharsetException {
        if (s == null) {
            throw new IllegalArgumentException("Content type may not be null");
        }
        HeaderElement[] elements = BasicHeaderValueParser.parseElements(s, null);
        if (elements.length > 0) {
            return create(elements[0]);
        } else {
            throw new ParseException("Invalid content type: " + s);
        }
    }
587177
func NewParser(r io.Reader, builder *Builder, options ...ParserOptions) *Parser {
	d := json.NewDecoder(r)
	d.UseNumber()
	p := &Parser{
		decoder: d,
		builder: builder,
	}
	if len(options) > 0 {
		p.options = options[0]
	}
	return p
}
1095855
public void addFieldParser(char type, SdpParser<? extends SdpField> parser) {
		synchronized (this.fieldParsers) {
			this.fieldParsers.put(type, parser);
		}
	}
1281304
private static SAXParser makeSAXParser() throws ParserConfigurationException, SAXException {
    SAXParser parser = _saxParser.get();
    if (parser != null) {
      try {
        parser.reset();
      } catch (UnsupportedOperationException uoe) {
        parser = null;
      }
    }
    if (parser == null) {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      parser = factory.newSAXParser();
      _saxParser.set( parser );
    }
    return parser;
  }