Read a <code>RuleSet</code> from an <code>InputSource</code>.

@param in
The rule-set input-source.

@return The rule-set.
326010
public ChangeSet read(final InputSource in) throws SAXException,
                                                  IOException {
        return (ChangeSet) this.parser.read( in );
    }
1238139
final public Selector GeneralSetPredicate() throws ParseException {
                                   Selector expr; List set; boolean neg=false;
    if (strict) {if (true) throw generateParseException();}
    expr = Expression();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case NOT:
      jj_consume_token(NOT);
                                  neg = true;
      break;
    default:
      jj_la1[13] = jj_gen;
      ;
    }
    jj_consume_token(IN);
    set = SetExpr();
    Selector ans = ParseUtil.convertSet(expr, set);
    if (neg) ans = new OperatorImpl(Operator.NOT, ans);
    {if (true) return ans;}
    throw new Error("Missing return statement in function");
  }
975128
static NewYearStrategy readFromStream(DataInput in) throws IOException {

        int n = in.readInt();

        if (n == 0) {
            NewYearRule rule = NewYearRule.valueOf(in.readUTF());
            int annoDomini = in.readInt();

            if ((annoDomini == Integer.MAX_VALUE) && (rule == NewYearRule.BEGIN_OF_JANUARY)) {
                return NewYearStrategy.DEFAULT;
            } else {
                return new NewYearStrategy(rule, annoDomini);
            }
        }

        List<NewYearStrategy> strategies = new ArrayList<>(n);

        for (int i = 0; i < n; i++) {
            NewYearRule rule = NewYearRule.valueOf(in.readUTF());
            int annoDomini = in.readInt();
            strategies.add(new NewYearStrategy(rule, annoDomini));
        }

        return new NewYearStrategy(strategies);

    }
1362331
@Override
    public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) {
        sourceSet.addAll(getFilterAsUnicodeSet(inputFilter));
        for (EscapeTransliterator it = this; it != null ; it = it.supplementalHandler) {
            if (inputFilter.size() != 0) {
                targetSet.addAll(it.prefix);
                targetSet.addAll(it.suffix);
                StringBuilder buffer = new StringBuilder();
                for (int i = 0; i < it.radix; ++i) {
                    Utility.appendNumber(buffer, i, it.radix, it.minDigits);
                }
                targetSet.addAll(buffer.toString()); // TODO drop once String is changed to CharSequence in UnicodeSet
            }
        }
    }
31756
public static <T> InputReader getInstance(T input, int size, Charset cs, Set<ParserFeature> features) throws IOException
    {
        try
        {
            Class<?> inputClass = input.getClass();
            MethodHandle mh = inputMap.get(inputClass);
            if (mh != null)
            {
                return (InputReader) mh.invoke(input, size, cs, features);
            }
            else
            {
                for (Entry<Class<?>,MethodHandle> e : inputMap.entrySet())
                {
                    if (e.getKey().isAssignableFrom(inputClass))
                    {
                        mh = e.getValue();
                        break;
                    }
                }
                if (mh == null)
                {
                    throw new IOException(input+" not assignable to any of "+inputMap.keySet());
                }
            }
            return (InputReader) mh.invoke(input, size, cs, features);
        }
        catch (Throwable ex)
        {
            if (ex instanceof IOException)
            {
                throw (IOException)ex;
            }
            else
            {
                throw new IOException(ex);
            }
        }
    }
818538
public static Set<String> getGroups(AclRuleSetSource source){
        HashSet<String> strings = new HashSet<>();
        for (AclRule rule : source.getRuleSet().getRules()) {
            if(rule.getGroup()!=null) {
                strings.add(rule.getGroup());
            }
        }
        return strings;
    }
1077684
public static SourceSet parse(String srcset, ErrorHandler errorHandler)
  {
    return new Parser(errorHandler).parse(srcset);
  }
1046094
private void readObject(final java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException {
         try {
           field = (String) in.readObject();
           String patternString = (String) in.readObject();
           pattern = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE);
         } catch (PatternSyntaxException e) {
             throw new IOException("Invalid LIKE rule - " + e.getMessage());
         }
   }
240484
@SuppressWarnings("unchecked")
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        super.readExternal(in);
        rule = (RuleImpl) in.readObject();
        subrule = (GroupElement) in.readObject();
        subruleIndex = in.readInt();
        previousTupleSinkNode = (LeftTupleSinkNode) in.readObject();
        nextTupleSinkNode = (LeftTupleSinkNode) in.readObject();

        salienceDeclarations = ( Declaration[]) in.readObject();
        enabledDeclarations = ( Declaration[]) in.readObject();
        consequenceName = (String) in.readObject();

        fireDirect = rule.getActivationListener().equals( "direct" );

        initDeclarations();
    }
835845
private boolean loadMatchRulesFromJar(String rulesUrl) {
	//load match rules from a local file
	try {
	    mCallbacks.printOutput("Loading match rules from local jar: " + rulesUrl);
            InputStream in = getClass().getClassLoader().getResourceAsStream(rulesUrl); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(in));

            processMatchRules(reader);
            
            return true;

	} catch (IOException e) {
	    scan.printStackTrace(e);
	} catch (NumberFormatException e) {
	    scan.printStackTrace(e);
	}
        
        return false;
    }
136359
private void loadStopWords(Set<String> set, InputStream in){
		BufferedReader bufr;
		try
		{
			bufr = new BufferedReader(new InputStreamReader(in));
			String line=null;
			while((line=bufr.readLine())!=null) {
				set.add(line.trim());
			}
			try
			{
				bufr.close();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
754283
public static <T extends Collection<String>> T readLines(InputStream in, Charset charset, T collection) throws IORuntimeException {
		return readLines(getReader(in, charset), collection);
	}
417477
public static String readInputStreamBufferedAsString(final InputStream in, final String charset) throws IOException {
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new UnicodeReader(in, charset));
			StringBuilder result = new StringBuilder();
			char[] cbuf = new char[2048];
			int read;
			while ((read = reader.read(cbuf)) > 0)
				result.append(cbuf, 0, read);
			return result.toString();
		} finally {
			closeIgnoringException(reader);
		}

	}
15194
public IGeneratorSet getGeneratorSet()
    {
    SAXParser parser;
    try
      {
      parser = SAXParserFactory.newInstance().newSAXParser();
      }
    catch( Exception e)
      {
      throw new RuntimeException( "Can't create SAXParser", e);
      }

    try
      {
      parser.parse( getInputStream(), this);
      }
    catch( SAXParseException spe)
      {
      throw
        new RuntimeException
        ( "Error in document at line=" + spe.getLineNumber(),
          spe);
      }
    catch( Exception e)
      {
      throw new RuntimeException( "Can't read GeneratorSet", e);
      }

    return generatorSet_;
    }
290179
@Override
    public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) {
        UnicodeSet myFilter = getFilterAsUnicodeSet(inputFilter);
        if (myFilter.size() > 0) {
            sourceSet.addAll(myFilter);
            targetSet.addAll('0', '9')
            .addAll('A', 'Z')
            .add('-')
            .add(' ')
            .addAll(OPEN_DELIM)
            .add(CLOSE_DELIM)
            .addAll('a', 'z') // for controls
            .add('<').add('>') // for controls
            .add('(').add(')') // for controls
            ;
        }
    }
1340951
public static PolicyCollection policiesFromSource(
            final YamlSource source,
            final Set<Attribute> forcedContext,
            final ValidationSet validation
    )
            throws IOException
    {

        return factory.policiesFromSource(source, forcedContext, validation);
    }
1059432
public static Reader getInputStreamReader(InputStream in, String charset) {
    try {
      return new InputStreamReader(in, charset);
    }
    catch (UnsupportedEncodingException ex) {
      throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
    }
  }