Code example for StringReader

Methods: read

0
 
	} 
 
	public DnNameComponent parseDnNameComponent(String dnNameComponentString)
			throws InvalidNameException { 
		Reader sr = new StringReader(dnNameComponentString);
		AntlrDnParser parser = setUpParser(sr);
 
		try { 
			DnNameComponent toReturn = parser.namecomponent();
			if (sr.read() != -1) {
				throw new InvalidNameException("extra charactes to be parsed"); 
			} 
			return toReturn;
		} catch (ANTLRException e) {
			final InvalidNameException invalidNameException = new InvalidNameException();
			invalidNameException.setRootCause(e);
			throw invalidNameException;
		} catch (IOException e) {
			throw new RuntimeException(e);
		}