com.bandwidth.utilities.FileWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bandwidth-sdk Show documentation
Show all versions of bandwidth-sdk Show documentation
The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs
/*
* BandwidthLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
package com.bandwidth.utilities;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.File;
import java.io.FileInputStream;
/**
* Class to wrap file and contentType to be sent as part of a HTTP request.
*/
public class FileWrapper {
@JsonInclude(JsonInclude.Include.NON_ABSENT)
private File file;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
private byte[] fileStream;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String contentType;
/**
* Initialization constructor.
* @param file File object to be wrapped
* @param contentType content type of file
*/
public FileWrapper(File file, String contentType) {
this.file = file;
this.fileStream = null;
this.contentType = contentType;
}
/**
* Initialization constructor.
* @param fileStream File Input Stream object to be wrapped
* @param contentType content type of file
*/
public FileWrapper(byte[] fileStream, String contentType) {
this.file = null;
this.fileStream = fileStream;
this.contentType = contentType;
}
/**
* Initialization constructor.
* @param file File object to be wrapped
*/
public FileWrapper(File file) {
this.file = file;
}
/**
* Initialization constructor.
* @param fileStream File object to be wrapped
*/
public FileWrapper(byte[] fileStream) {
this.fileStream = fileStream;
}
/**
* Getter for file.
* @return File instance
*/
public File getFile() { return file; }
/**
* Getter for fileStream.
* @return byte[] instance
*/
public byte[] getFileStream() { return fileStream; }
/**
* Getter for content type.
* @return content type of the file
*/
public String getContentType() {
return contentType;
}
}