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

com.aliyun.oss.model.InputSerialization Maven / Gradle / Ivy

Go to download

The Aliyun OSS SDK for Java used for accessing Aliyun Object Storage Service, includes all service and dependent JARs.

The newest version!
package com.aliyun.oss.model;

import java.io.Serializable;

/**
 * Define input serialization of the select object operations.
 */
public class InputSerialization implements Serializable {
    // Default input format is csv
    private SelectContentFormat selectContentFormat = SelectContentFormat.CSV;
    private CSVFormat csvInputFormat = new CSVFormat();
    private JsonFormat jsonInputFormat = new JsonFormat();
    private String compressionType = CompressionType.NONE.name();

    public SelectContentFormat getSelectContentFormat() {
        return selectContentFormat;
    }

    public void setSelectContentFormat(SelectContentFormat selectContentFormat) {
        this.selectContentFormat = selectContentFormat;
    }

    public CSVFormat getCsvInputFormat() {
        return csvInputFormat;
    }

    public void setCsvInputFormat(CSVFormat csvInputFormat) {
        setSelectContentFormat(SelectContentFormat.CSV);
        this.csvInputFormat = csvInputFormat;
    }

    public InputSerialization withCsvInputFormat(CSVFormat csvFormat) {
        setCsvInputFormat(csvFormat);
        return this;
    }

    public JsonFormat getJsonInputFormat() {
        return jsonInputFormat;
    }

    public void setJsonInputFormat(JsonFormat jsonInputFormat) {
        if (jsonInputFormat.getJsonType() == null) {
            throw new IllegalArgumentException("Please set json type for this input, valid types are DOCUMENT and LINES");
        }
        setSelectContentFormat(SelectContentFormat.JSON);
        this.jsonInputFormat = jsonInputFormat;
    }

    public InputSerialization withJsonInputFormat(JsonFormat jsonInputFormat) {
        setJsonInputFormat(jsonInputFormat);
        return this;
    }

    public String getCompressionType() {
        return compressionType;
    }

    public void setCompressionType(CompressionType compressionType) {
        this.compressionType = compressionType.name();
    }

    public InputSerialization withCompressionType(CompressionType compressionType) {
        setCompressionType(compressionType);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy