Begins an array with an expected name.

@param expectedName The name that the next array should have
@return the structured reader
@throws IOException Something happened reading or the expected name was not found
513369
public JsonReader beginArray(String expectedName) throws IOException {
      String name = beginArray();
      if (!StringUtils.isNullOrBlank(expectedName) && (name == null || !name.equals(expectedName))) {
         throw new IOException("Expected " + expectedName);
      }
      return this;
   }
401194
public ICalendar first() throws IOException {
		StreamReader reader = constructReader();
		if (index != null) {
			reader.setScribeIndex(index);
		}

		try {
			ICalendar ical = reader.readNext();
			if (warnings != null) {
				warnings.add(reader.getWarnings());
			}
			return ical;
		} finally {
			if (closeWhenDone()) {
				reader.close();
			}
		}
	}
159469
public String nextName() throws IOException {
    int p = peeked;
    if (p == PEEKED_NONE) {
      p = doPeek();
    }
    String result;
    if (p == PEEKED_UNQUOTED_NAME) {
      result = nextUnquotedValue();
    } else if (p == PEEKED_SINGLE_QUOTED_NAME) {
      result = nextQuotedValue('\'');
    } else if (p == PEEKED_DOUBLE_QUOTED_NAME) {
      result = nextQuotedValue('"');
    } else {
      throw new IllegalStateException("Expected a name but was " + peek() + locationString());
    }
    peeked = PEEKED_NONE;
    pathNames[stackSize - 1] = result;
    return result;
  }
149252
public Token next() throws IOException {
        skipWhitespace();
        int c = reader.read();
        if (c < 0) {
            return new Token(Token.EOF);
        } else if (c == '\n') {
            return new Token(Token.EOL);
        } else if (c == '\'' || c == '"') {
            return munchString(c);
        } else if (c == '/') {
            return maybeComment();
        } else if (single.get(c)) {
            return new Token(Token.SINGLE, String.valueOf((char) c));
        } else {
            reader.unread(c);
            return parseWord();
        }
    }
846562
protected void readInitialHeaders() throws IOException
	{
		String line;
		while ((line = readCRLFLine()).length()!=0)
		{
			int colonIndex = line.indexOf(':');
			// does it have a ':' separator
			if (colonIndex == -1) continue;
			String tagName = line.substring(0, colonIndex);
			String value = line.substring(colonIndex + 1);
			if (value.toLowerCase().endsWith("<br>")) value = value.substring(0, value.length()-4);
			IcyTag tag = new IcyTag(tagName, value);
			addTag(tag);
		}
	}
139818
public static QName readQName(XMLStreamReader reader) throws XMLStreamException {
        String value = reader.getElementText();
        if (value == null) {
            return null;
        }
        value = value.trim();

        int index = value.indexOf(":");

        if (index == -1) {
            return new QName(value);
        }

        String prefix = value.substring(0, index);
        String localName = value.substring(index + 1);
        String ns = reader.getNamespaceURI(prefix);

        if ((!StringUtils.isEmpty(prefix) && ns == null) || localName == null) {
            throw new RuntimeException("Invalid QName in mapping: " + value);
        }

        if (ns == null) {
            return new QName(localName);
        }

        return new QName(ns, localName, prefix);
    }
1139606
public Tuple2<String, Val> nextKeyValue() throws IOException {
      if (currentValue.getKey() != NAME) {
         throw new IOException("Expecting NAME, but found " + jsonTokenToStructuredElement(null));
      }
      String name = currentValue.getValue().asString();
      consume();
      return Tuple2.of(name, nextValue());
   }
90142
public String nextName() throws IOException {
        peek();
        if (token != JsonToken.NAME) {
            throw new IllegalStateException("Expected a name but was " + peek());
        }
        String result = name;
        advance();
        return result;
    }
823341
public static ElementSelector selectorForElementNamed(final String expectedName,
                                                          final ElementSelector es) {
        if (expectedName == null) {
            throw new IllegalArgumentException("expectedName must not be null");
        }

        return conditionalSelector(elementNamePredicate(expectedName), es);
    }
241887
public static ImmutableList<File> loadFileList(final Iterable<String> fileNames)
      throws IOException {
    final ImmutableList.Builder<File> ret = ImmutableList.builder();

    for (String filename : fileNames) {
      if (!filename.isEmpty()) {
        ret.add(new File(filename.trim()));
      }
    }

    return ret.build();
  }
394665
public JsonReader beginDocument() throws IOException {
      if (currentValue.getKey() != BEGIN_OBJECT && currentValue.getKey() != BEGIN_ARRAY) {
         throw new IOException("Expecting BEGIN_OBJECT or BEGIN_ARRAY, but found " + jsonTokenToStructuredElement(
            null));
      }
      documentType = currentValue.getKey();
      consume();
      return this;
   }
993740
public void beginElement(String elementName) throws IOException {		
		addElementName(elementName);
		indent();
		writer.write("<");
		writer.write(elementName);
	}
480279
@Override
    public void readExternal(PofReader reader) throws IOException {
        nodeName = reader.readString(0);
        namespace = reader.readString(1);
    }
494981
public ObjectName build() {
    final String name = nameStrBuilder.substring(0, nameStrBuilder.length() - 1);
    try {
      return new ObjectName(name);
    } catch (MalformedObjectNameException e) {
      LOG.warn("Invalid ObjectName provided: " + name);
      throw Throwables.propagate(e);
    }
  }
288595
protected static String read(Reader file) throws IOException {
		final StringBuilder content = new StringBuilder();
		try (BufferedReader reader = new BufferedReader(file)) {
			String line = reader.readLine();
			boolean first = true;
			while (line != null) {
				if (first) {
					first = false;
				} else {
					content.append("\n"); //$NON-NLS-1$
				}
				content.append(line);
				line = reader.readLine();
			}
		}
		return content.toString();
	}
416325
public static <T> Parser<T> unexpected(final String name) {
    return new Parser<T>() {
      @Override boolean apply(final ParseContext ctxt) {
        ctxt.unexpected(name);
        return false;
      }
      @Override public String toString() {
        return name;
      }
    };
  }
405313
static private String readFile(String fileName) throws IOException {
    BufferedReader br = new BufferedReader(new FileReader(fileName));
    try {
      StringBuilder sb = new StringBuilder();
      String line = br.readLine();

      while (line != null) {
        sb.append(line);
        sb.append("\n");
        line = br.readLine();
      }
      return sb.toString();
    } finally {
      br.close();
    }
  }