code: public List<NodeTypeData> read(InputStream is) throws RepositoryException
     {
        try
        {
           if (is != null)
           {
              /** Lexing input stream */
              CNDLexer lex = new CNDLexer(new ANTLRInputStream(is));
              CommonTokenStream tokens = new CommonTokenStream(lex);
              /** Parsing input stream */
              CNDParser parser = new CNDParser(tokens);
              CNDParser.cnd_return r;
              /** Throw exception if any lex errors found */
              if (lex.hasError())
              {
                 throw new RepositoryException("Lexer errors found " + lex.getErrors().toString());
              }
              r = parser.cnd();
              /** Throw exception if any parse errors found */
              if (parser.hasError())
              {
                 throw new RepositoryException("Parser errors found " + parser.getErrors().toString());
              }
              CommonTreeNodeStream nodes = new CommonTreeNodeStream(r.getTree());
              CNDWalker walker = new CNDWalker(nodes);
              /**
               * Running tree walker to build nodetypes. Namespace registry is
               * provided to register namespaced mentioned in stream and
               * locationFactory is used to parse JCR names
               */
              walker.cnd(namespaceRegistry);
              return walker.getNodeTypes();
           }
           else
           {
              return new ArrayList<NodeTypeData>();
           }
  
        }
        catch (IOException e)
        {
           throw new RepositoryException(e.getMessage(), e);
        }
        catch (RecognitionException e)
        {
           throw new RepositoryException(e.getMessage(), e);
        }
     }
docs: Method which reads input stream as compact node type definition string. If
  any namespaces are placed in stream they are registered through namespace
  registry.
  
  @param is {@link InputStream} to read from.
  @return List of parsed nodetypes
  @throws RepositoryException Exception is thrown when wrong input is
  provided in stream or any {@link IOException} are repacked to
  {@link RepositoryException}