## com.baidubce.services.vod.model
Class CreateMediaResourceRequest

    java.lang.Object
      com.baidubce.model.AbstractBceRequest
          com.baidubce.services.vod.model.CreateMediaResourceRequest

    public class CreateMediaResourceRequest

extends AbstractBceRequest

Uploads a new object to the specified Baidu VOD bucket. The PutObjectRequest optionally uploads object metadata and applies a canned access control policy to the new object.

Baidu VOD never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored.

Constructor Summary
`CreateMediaResourceRequest()`

Method Summary
`File` `getFile()` Gets the path and name of the file containing the data to be uploaded to Baidu Bos.
`InputStream` `getInputStream()` Gets the input stream containing the data to be uploaded to Baidu Bos.
`ObjectMetadata` `getObjectMetadata()` Gets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g.
`void` `setFile(File file)` Sets the path and name of the file containing the data to be uploaded to Baidu Bos.
`void` `setInputStream(InputStream inputStream)` Sets the input stream containing the data to be uploaded to Baidu Bos.
`void` `setObjectMetadata(ObjectMetadata objectMetadata)` Sets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g.
`CreateMediaResourceRequest` `withFile(File file)` Sets the file containing the data to be uploaded to Baidu Bos.
`CreateMediaResourceRequest` `withInputStream(InputStream inputStream)` Sets the input stream containing the data to be uploaded to Baidu Bos.
`CreateMediaResourceRequest` `withObjectMetadata(ObjectMetadata objectMetadata)` Sets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g.
`AbstractBceRequest` `withRequestCredentials(BceCredentials credentials)`

Methods inherited from class com.baidubce.model.AbstractBceRequest
`getRequestCredentials, setRequestCredentials`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CreateMediaResourceRequest

    public CreateMediaResourceRequest()

Method Detail

### withRequestCredentials

    public AbstractBceRequest withRequestCredentials(BceCredentials credentials)

  Specified by:
    `withRequestCredentials` in class `AbstractBceRequest`

### getFile

    public File getFile()

  Gets the path and name of the file containing the data to be uploaded to Baidu Bos. Either specify a file or an input stream containing the data to be uploaded to Baidu Bos; both cannot be specified.

  Returns:
    The path and name of the file containing the data to be uploaded to Baidu Bos.

### setFile

    public void setFile(File file)

  Sets the path and name of the file containing the data to be uploaded to Baidu Bos. Either specify a file or an input stream containing the data to be uploaded to Baidu Bos; both cannot be specified.

  Parameters:
    `file` - The path and name of the file containing the data to be uploaded to Baidu Bos.

### withFile

    public CreateMediaResourceRequest withFile(File file)

  Sets the file containing the data to be uploaded to Baidu Bos. Returns this PutObjectRequest, enabling additional method calls to be chained together.

  Either specify a file or an input stream containing the data to be uploaded to Baidu Bos; both cannot be specified.

  Parameters:
    `file` - The file containing the data to be uploaded to Baidu Bos.
  Returns:
    This PutObjectRequest, enabling additional method calls to be chained together.

### getObjectMetadata

    public ObjectMetadata getObjectMetadata()

  Gets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).

  If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Baidu Bos. This can cause very negative performance impacts.

  Returns:
    The optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).

### setObjectMetadata

    public void setObjectMetadata(ObjectMetadata objectMetadata)

  Sets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).

  If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Baidu Bos. This can cause very negative performance impacts.

  Parameters:
    `objectMetadata` - The optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).

### withObjectMetadata

    public CreateMediaResourceRequest withObjectMetadata(ObjectMetadata objectMetadata)

  Sets the optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.). Returns this PutObjectRequest, enabling additional method calls to be chained together.

  If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Baidu Bos. This can cause very negative performance impacts.

  Parameters:
    `objectMetadata` - The optional metadata instructing Baidu Bos how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
  Returns:
    This PutObjectRequest, enabling additional method calls to be chained together.

### getInputStream

    public InputStream getInputStream()

  Gets the input stream containing the data to be uploaded to Baidu Bos. The user of this request must either specify a file or an input stream containing the data to be uploaded to Baidu Bos; both cannot be specified.

  Returns:
    The input stream containing the data to be uploaded to Baidu Bos. Either specify a file or an input stream containing the data to be uploaded to Baidu Bos, not both.

### setInputStream

    public void setInputStream(InputStream inputStream)

  Sets the input stream containing the data to be uploaded to Baidu Bos. Either specify a file or an input stream containing the data to be uploaded to Baidu Bos; both cannot be specified.

  Parameters:
    `inputStream` - The input stream containing the data to be uploaded to Baidu Bos. Either specify a file or an input stream containing the data to be uploaded to Baidu Bos, not both.

### withInputStream

    public CreateMediaResourceRequest withInputStream(InputStream inputStream)

  Sets the input stream containing the data to be uploaded to Baidu Bos. Returns this PutObjectRequest, enabling additional method calls to be chained together.

  Either specify a file or an input stream containing the data to be uploaded to Baidu Bos; both cannot be specified.

  Parameters:
    `inputStream` - The InputStream containing the data to be uploaded to Baidu Bos.
  Returns:
    This PutObjectRequest, so that additional method calls can be chained together.

Copyright © 2016. All rights reserved.