Parse a named {@code .proto} schema. The {@code InputStream} is not closed.
505123
public static ProtoFile parseUtf8(String name, InputStream is) throws IOException {
    return parse(name, new InputStreamReader(is, UTF_8));
  }
824195
def schema(self):
        
        if self._schema is None:
            try:
                self._schema = _parse_datatype_json_string(self._jdf.schema().json())
            except AttributeError as e:
                raise Exception(
                    "Unable to parse datatype from schema. %s" % e)
        return self._schema
293046
public Schema compileSchema( InputStream stream )
		throws VerifierConfigurationException, SAXException, IOException {
		
		return compileSchema(stream,null);
	}
441727
private void parse(String fileName, @WillClose InputStream stream) throws IOException, SAXException {
        try {
            SAXBugCollectionHandler handler = new SAXBugCollectionHandler(this, new File(fileName));
            XMLReader xr = XMLReaderFactory.createXMLReader();
            xr.setContentHandler(handler);
            xr.setErrorHandler(handler);
            Reader reader = Util.getReader(stream);
            xr.parse(new InputSource(reader));
        } finally {
            Util.closeSilently(stream);
        }
    }
257034
public final ProtoParser.parse_return parse(Proto proto) throws RecognitionException {
        ProtoParser.parse_return retval = new ProtoParser.parse_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token EOF2=null;
        ProtoParser.statement_return statement1 = null;


        Object EOF2_tree=null;

        try {
            // com/dyuproject/protostuff/parser/ProtoParser.g:53:5: ( ( statement[proto] )+ EOF )
            // com/dyuproject/protostuff/parser/ProtoParser.g:53:9: ( statement[proto] )+ EOF
            {
            root_0 = (Object)adaptor.nil();

            // com/dyuproject/protostuff/parser/ProtoParser.g:53:9: ( statement[proto] )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                switch ( input.LA(1) ) {
                case AT:
                case PKG:
                case SYNTAX:
                case IMPORT:
                case OPTION:
                case MESSAGE:
                case SERVICE:
                case ENUM:
                case EXTEND:
                    {
                    alt1=1;
                    }
                    break;

                }

                switch (alt1) {
            	case 1 :
            	    // com/dyuproject/protostuff/parser/ProtoParser.g:53:10: statement[proto]
            	    {
            	    pushFollow(FOLLOW_statement_in_parse178);
            	    statement1=statement(proto);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, statement1.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
            	    if (state.backtracking>0) {state.failed=true; return retval;}
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);

            EOF2=(Token)match(input,EOF,FOLLOW_EOF_in_parse183); if (state.failed) return retval;
            if ( state.backtracking==0 ) {

                          if(!proto.annotations.isEmpty())
                              throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
                          
                          proto.postParse();
                      
            }

            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
852185
public static SshPrivateKeyFile parse(InputStream in) throws IOException {

		try {
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			int read;
			while ((read = in.read()) > -1) {
				out.write(read);
			}
			return parse(out.toByteArray());
		} finally {
			try {
				in.close();
			} catch (IOException ex) {
			}
		}

	}
802101
@NotNull
    public static Document parseDocument(@NotNull final DocumentBuilder builder,
            @NotNull final InputStream inputStream) {
        Contract.requireArgNotNull("builder", builder);
        Contract.requireArgNotNull("inputStream", inputStream);
        try {
            return builder.parse(inputStream);
        } catch (final SAXException | IOException ex) {
            throw new RuntimeException("Failed to parse XML", ex);
        }
    }
672401
public static Schema parseSchemaFromFile(Path filePath, FileSystem fs) throws IOException {
    Preconditions.checkArgument(fs.exists(filePath), filePath + " does not exist");

    try (FSDataInputStream in = fs.open(filePath)) {
      return new Schema.Parser().parse(in);
    }
  }
531780
@Override
  public GenericRecord parse(ByteBuffer bytes)
  {
    if (bytes.remaining() < 5) {
      throw new ParseException("record must have at least 5 bytes carrying version and schemaId");
    }

    byte version = bytes.get();
    if (version != V1) {
      throw new ParseException("found record of arbitrary version [%s]", version);
    }

    int schemaId = bytes.getInt();
    Schema schemaObj = schemaObjs.get(schemaId);
    if (schemaObj == null) {
      throw new ParseException("Failed to find schema for id [%s]", schemaId);
    }

    DatumReader<GenericRecord> reader = new GenericDatumReader<>(schemaObj);
    try (ByteBufferInputStream inputStream = new ByteBufferInputStream(Collections.singletonList(bytes))) {
      return reader.read(null, DecoderFactory.get().binaryDecoder(inputStream, null));
    }
    catch (EOFException eof) {
      // waiting for avro v1.9.0 (#AVRO-813)
      throw new ParseException(
          eof,
          "Avro's unnecessary EOFException, detail: [%s]",
          "https://issues.apache.org/jira/browse/AVRO-813"
      );
    }
    catch (Exception e) {
      throw new ParseException(e, "Fail to decode avro message with schemaId [%s].", schemaId);
    }
  }
1068070
static TableSchema parseTableSchema(String tableSchemaJson) throws IOException {
    JsonParser parser = JacksonFactory.getDefaultInstance().createJsonParser(tableSchemaJson);
    return parser.parseAndClose(TableSchema.class);
  }
1352355
private String createProtocol(String name, StreamSchema schema) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("PROTOCOL ").append(name).append(" {").append(Constants.NEWLINE);
    stringBuilder.append(StreamSchemaCodec.serialize(schema));
    stringBuilder.append("}").append(Constants.NEWLINE);
    return stringBuilder.toString();
  }
48911
public void parse (InputStream input) {
		try {
			parse(new InputStreamReader(input, "UTF-8"));
		} catch (IOException ex) {
			throw new SerializationException(ex);
		} finally {
			StreamUtils.closeQuietly(input);
		}
	}
1114958
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema,
            boolean numeric, LinkedBuffer buffer) throws IOException
    {
        final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(),
                in, false);
        final JsonParser parser = newJsonParser(in, buffer.buffer, 0, 0, false, context);
        try
        {
            return parseListFrom(parser, schema, numeric);
        }
        finally
        {
            parser.close();
        }
    }
813632
@Override
    protected XMLValidationSchema loadSchema(InputSource src, Object sysRef)
        throws XMLStreamException
    {
        /* 26-Oct-2007, TSa: Are sax parser factories safe to share?
         *   If not, should just create new instances for each
         *   parsed schema.
         */
        /* Another thing; should we use a controller to get notified about
         * errors in parsing?
         */
        SAXParserFactory saxFactory = getSaxFactory();
        MyGrammarController ctrl = new MyGrammarController();
        TREXGrammar grammar = RELAXNGReader.parse(src, saxFactory, ctrl);
        if (grammar == null) {
            String msg = "Failed to load RelaxNG schema from '"+sysRef+"'";
            String emsg = ctrl.mErrorMsg;
            if (emsg != null) {
                msg = msg + ": "+emsg;
            }
            throw new XMLStreamException(msg);
        }
        return new RelaxNGSchema(grammar);
    }
254100
public void parse(InputStream script, Binding binding) {
        if (script==null)
            throw new IllegalArgumentException("No script is provided");
        setBinding(binding);
        CompilerConfiguration cc = new CompilerConfiguration();
        cc.setScriptBaseClass(ClosureScript.class.getName());
        GroovyShell shell = new GroovyShell(classLoader,binding,cc);

        ClosureScript s = (ClosureScript)shell.parse(new InputStreamReader(script));
        s.setDelegate(this);
        s.run();
    }
1118810
protected static Element parse(InputStream stream) throws IOException {
        try {
            return DBF.get().newDocumentBuilder().parse(stream).getDocumentElement();
        }
        catch (SAXException | ParserConfigurationException e) {
            throw new IOException("parsing stream failed", e);
        }
        finally {
            stream.close();
        }
    }
237320
public VOMSResponse parse(InputStream inputStream) {

    try {

      Document document = docBuilder.parse(inputStream);

      return new RESTVOMSResponse(document);

    } catch (Exception e) {

      throw new VOMSError(e.getMessage());

    }
  }