public static List<CommandOperation> parse(Reader rdr) throws IOException { return parse(rdr, Collections.emptySet()); }
/** * Read commands from request streams * * @param streams the streams * @param resp solr query response * @param singletonCommands , commands that cannot be repeated * @return parsed list of commands * @throws IOException if there is an error while parsing the stream */ public static List<CommandOperation> readCommands(Iterable<ContentStream> streams, NamedList resp, Set<String> singletonCommands) throws IOException { if (streams == null) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream"); } ArrayList<CommandOperation> ops = new ArrayList<>(); for (ContentStream stream : streams) { if ("application/javabin".equals(stream.getContentType())) { ops.addAll(parse(stream.getStream(), singletonCommands)); } else { ops.addAll(parse(stream.getReader(), singletonCommands)); } } List<Map> errList = CommandOperation.captureErrors(ops); if (!errList.isEmpty()) { resp.add(CommandOperation.ERR_MSGS, errList); return null; } return ops; }