All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.bingads.v13.reporting.ReportFileReader Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 13.0.22.1
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy