# Google Data APIs Client Library (1.43.0)

## com.google.gdata.data.media
Interface MediaSource

All Superinterfaces:
  javax.activation.DataSource

All Known Implementing Classes:
  BaseMediaSource, MediaByteArraySource, MediaFileSource, MediaStreamSource, Rfc822MediaSource

    public interface MediaSource

extends javax.activation.DataSource

The MediaSource interface provides a model for accessing media content sent by the GData client or returned by a GDataFeed service implementation. It extends the JavaBeans Activation Framework `DataSource` interface, making it possible to use the MediaSource as a DataSource within the framework for media handling.

When creating new GData entries using a `MediaSource`, the return value of the `DataSource.getName()` method will be used to create a Slug header for the media source. Some concrete implementations of the MediaSource interface will provide the ability to set the name value and/or provide a default value based upon source attributes.

Nested Class Summary
`static class` `MediaSource.Output` The Output class provides helper methods for MediaSource handling.

Method Summary
`long` `getContentLength()` Returns the length (in bytes) of the media source.
`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.

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

Method Detail

### getContentLength

    long getContentLength()

  Returns the length (in bytes) of the media source. A value of -1 indicates the length is unknown.

### getLastModified

    DateTime getLastModified()

  Returns the last modification time of the media content or `null` if unknown.

### getEtag

    java.lang.String getEtag()

  Returns the entity tag (etag) value associated with the media content or `null` if unknown.