# Google Data APIs Client Library (1.43.0)

## com.google.gdata.data.media
Class BaseMediaSource

    java.lang.Object
      com.google.gdata.data.media.BaseMediaSource

All Implemented Interfaces:
  MediaSource, javax.activation.DataSource

Direct Known Subclasses:
  MediaByteArraySource, MediaFileSource, MediaStreamSource

    public abstract class BaseMediaSource

extends java.lang.Object
implements MediaSource

The BaseMediaSource class provides an abstract base class implementation of the `MediaSource` interface.

See Also:
  `MediaSource`

Nested Class Summary

Nested classes/interfaces inherited from interface com.google.gdata.data.media.MediaSource
`MediaSource.Output`

Field Summary
`protected long` `contentLength`
`protected java.lang.String` `etag`
`protected DateTime` `lastModified`
`protected java.lang.String` `mediaType`
`protected java.lang.String` `name`

Constructor Summary
`protected` `BaseMediaSource(java.lang.String mediaType)` Constructs a new BaseMediaSource of the specified content type.

Method Summary
`long` `getContentLength()` Returns the length (in bytes) of the media source.
`java.lang.String` `getContentType()`
`java.lang.String` `getEtag()` Returns the entity tag (etag) value associated with the media content or `null` if unknown.
`DateTime` `getLastModified()` Returns the last modification time of the media content or `null` if unknown.
`java.lang.String` `getName()`
`void` `setContentLength(long contentLength)`
`void` `setEtag(java.lang.String etag)`
`void` `setLastModified(DateTime lastModified)`
`void` `setName(java.lang.String name)`

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

Methods inherited from interface javax.activation.DataSource
`getInputStream, getOutputStream`

Field Detail

### mediaType

    protected final java.lang.String mediaType

### contentLength

    protected long contentLength

### lastModified

    protected DateTime lastModified

### name

    protected java.lang.String name

### etag

    protected java.lang.String etag

Constructor Detail

### BaseMediaSource

    protected BaseMediaSource(java.lang.String mediaType)

  Constructs a new BaseMediaSource of the specified content type.

Method Detail

### getContentType

    public java.lang.String getContentType()

  Specified by:
    `getContentType` in interface `javax.activation.DataSource`

### setName

    public void setName(java.lang.String name)

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `javax.activation.DataSource`

### setLastModified

    public void setLastModified(DateTime lastModified)

### getLastModified

    public DateTime getLastModified()

  Description copied from interface: `MediaSource`
  Returns the last modification time of the media content or `null` if unknown.

  Specified by:
    `getLastModified` in interface `MediaSource`

### setContentLength

    public void setContentLength(long contentLength)

### getContentLength

    public long getContentLength()

  Description copied from interface: `MediaSource`
  Returns the length (in bytes) of the media source. A value of -1 indicates the length is unknown.

  Specified by:
    `getContentLength` in interface `MediaSource`

### setEtag

    public void setEtag(java.lang.String etag)

### getEtag

    public java.lang.String getEtag()

  Description copied from interface: `MediaSource`
  Returns the entity tag (etag) value associated with the media content or `null` if unknown.

  Specified by:
    `getEtag` in interface `MediaSource`