com.microsoft.bingads.v13.reporting.ReportFileReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft.bingads Show documentation
Show all versions of microsoft.bingads Show documentation
The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.
package com.microsoft.bingads.v13.reporting;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import javax.xml.stream.XMLStreamException;
import com.microsoft.bingads.v13.internal.reporting.RowReport;
import com.microsoft.bingads.v13.internal.reporting.XmlReport;
public class ReportFileReader implements Closeable {
private Report report;
private String reportFilePath;
public ReportFileReader(String filePath, ReportFormat format) throws IOException, XMLStreamException {
this(new File(filePath), format);
}
public ReportFileReader(File file, ReportFormat format) throws IOException, XMLStreamException {
this.reportFilePath = file.getCanonicalPath();
switch (format) {
case CSV:
case TSV:
report = new RowReport(file, format);
break;
case XML:
report = new XmlReport(file);
break;
}
}
@Override
public void close() throws IOException {
if (report != null) {
report.close();
report = null;
}
}
public Report getReport() {
return report;
}
public String getReportFilePath() throws IOException {
return reportFilePath;
}
}