com.univocity.api.net
Class DataParameter

java.lang.Object
  extended by com.univocity.api.net.DataParameter
All Implemented Interfaces:
Cloneable

public final class DataParameter
extends Object
implements Cloneable

Holds the details of a single data parameter sent in the body of POST requests. Supports plain key-value pairs and file uploads


Constructor Summary
DataParameter(String name, String value)
          Creates a new data parameter
DataParameter(String name, String filename, FileProvider fileToUpload)
          Creates a new upload parameter to be sent on the body of a POST request.
DataParameter(String name, String filename, FileProvider fileToUpload, String contentType)
          Creates a new upload parameter to be sent on the body of a POST request.
DataParameter(String name, String filename, InputStream uploadStream)
          Creates a new upload parameter to be sent on the body of a POST request.
DataParameter(String name, String filename, InputStream uploadStream, String contentType)
          Creates a new upload parameter to be sent on the body of a POST request.
DataParameter(String name, String filename, ResourceProvider<InputStream> uploadStream)
          Creates a new upload parameter to be sent on the body of a POST request.
DataParameter(String name, String filename, ResourceProvider<InputStream> uploadStream, String contentType)
          Creates a new upload parameter to be sent on the body of a POST request.
 
Method Summary
 DataParameter clone()
           
 boolean equals(Object o)
           
 String getContentType()
          Get the current Content Type, or null if not set.
 String getName()
          Returns the name of this data parameter
 ResourceProvider<InputStream> getUploadStream()
          Returns the upload stream provider that produces an InputStream of the data to be uploaded when called
 String getValue()
          Returns the plain String value associated with this data parameter
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataParameter

public DataParameter(String name,
                     String value)
Creates a new data parameter

Parameters:
name - the data parameter name
value - the value associated with the given data parameter

DataParameter

public DataParameter(String name,
                     String filename,
                     FileProvider fileToUpload)
Creates a new upload parameter to be sent on the body of a POST request.

Parameters:
name - the name of the data parameter
filename - the name of the file being uploaded
fileToUpload - the file to be uploaded

DataParameter

public DataParameter(String name,
                     String filename,
                     InputStream uploadStream)
Creates a new upload parameter to be sent on the body of a POST request.

Parameters:
name - the name of the data parameter
filename - the name of the file being uploaded
uploadStream - the InputStream with the contents to be uploaded

DataParameter

public DataParameter(String name,
                     String filename,
                     ResourceProvider<InputStream> uploadStream)
Creates a new upload parameter to be sent on the body of a POST request.

Parameters:
name - the name of the data parameter
filename - the name of the file being uploaded
uploadStream - a callback provider that returns an InputStream with the contents to be uploaded

DataParameter

public DataParameter(String name,
                     String filename,
                     FileProvider fileToUpload,
                     String contentType)
Creates a new upload parameter to be sent on the body of a POST request.

Parameters:
name - the name of the data parameter
filename - the name of the file being uploaded
fileToUpload - the file to be uploaded
contentType - the Content Type header used in the MIME body when uploading files. Defaults to application/octet-stream.

DataParameter

public DataParameter(String name,
                     String filename,
                     InputStream uploadStream,
                     String contentType)
Creates a new upload parameter to be sent on the body of a POST request.

Parameters:
name - the name of the data parameter
filename - the name of the file being uploaded
uploadStream - the InputStream with the contents to be uploaded
contentType - the Content Type header used in the MIME body when uploading files. Defaults to application/octet-stream.

DataParameter

public DataParameter(String name,
                     String filename,
                     ResourceProvider<InputStream> uploadStream,
                     String contentType)
Creates a new upload parameter to be sent on the body of a POST request.

Parameters:
name - the name of the data parameter
filename - the name of the file being uploaded
uploadStream - a callback provider that returns an InputStream with the contents to be uploaded
contentType - the Content Type header used in the MIME body when uploading files. Defaults to application/octet-stream.
Method Detail

getName

public final String getName()
Returns the name of this data parameter

Returns:
the data parameter name

getValue

public final String getValue()
Returns the plain String value associated with this data parameter

Returns:
the data parameter value

getUploadStream

public final ResourceProvider<InputStream> getUploadStream()
Returns the upload stream provider that produces an InputStream of the data to be uploaded when called

Returns:
the upload stream provider

toString

public String toString()
Overrides:
toString in class Object

getContentType

public final String getContentType()
Get the current Content Type, or null if not set.

Returns:
the current Content Type.

clone

public final DataParameter clone()
Overrides:
clone in class Object

equals

public final boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.