static BatchInfo loadBatchInfo(InputStream in) throws PullParserException, IOException, ConnectionException { BatchInfo info = new BatchInfo(); XmlInputStream xin = new XmlInputStream(); xin.setInput(in, "UTF-8"); info.load(xin, BulkConnection.typeMapper); return info; }
public BatchInfo getBatchInfo(String jobId, String batchId) throws AsyncApiException { try { String endpoint = getRestEndpoint() + "job/" + jobId + "/batch/" + batchId; URL url = new URL(endpoint); InputStream stream = doHttpGet(url); XmlInputStream xin = new XmlInputStream(); xin.setInput(stream, "UTF-8"); BatchInfo result = new BatchInfo(); result.load(xin, typeMapper); return result; } catch (IOException e) { throw new AsyncApiException( "Failed to parse batch info ", AsyncExceptionCode.ClientInputError, e); } catch (PullParserException e) { throw new AsyncApiException( "Failed to parse batch info ", AsyncExceptionCode.ClientInputError, e); } catch (ConnectionException e) { throw new AsyncApiException( "Failed to parse batch info ", AsyncExceptionCode.ClientInputError, e); } }