sk.baka.ambient.collection
Class AbstractAudio

java.lang.Object
  extended by sk.baka.ambient.collection.AbstractAudio
Direct Known Subclasses:
FileAudio, MediaStoreAudio

public abstract class AbstractAudio
extends Object

Contains information about an audio file.

Author:
Martin Vysny

Constructor Summary
protected AbstractAudio(String uri)
          Creates new audio object instance.
 
Method Summary
abstract  boolean exists()
          Checks if the file denoted by this object exists.
static AbstractAudio fromUri(String fileUri)
          Returns the audio object instance from a file denoted by given URI.
 String getLocation()
          Returns location of the audio file.
abstract  String getMimeType()
          Returns the file MIME type.
abstract  long getSize()
          Returns file size, in bytes.
abstract  boolean isReadable()
          Checks if the file denoted by this object is readable (i.e.
abstract  InputStream openInputStream()
          Reads the file contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAudio

protected AbstractAudio(String uri)
Creates new audio object instance.

Parameters:
uri - the URI
Method Detail

getLocation

public final String getLocation()
Returns location of the audio file.

Returns:
the location URI

exists

public abstract boolean exists()
Checks if the file denoted by this object exists.

Returns:
true if the file exists, false otherwise.

isReadable

public abstract boolean isReadable()
Checks if the file denoted by this object is readable (i.e. user has rights to read the file, etc).

Returns:
true if the file is readable, false otherwise.

openInputStream

public abstract InputStream openInputStream()
                                     throws IOException
Reads the file contents.

Returns:
input stream instance, never null.
Throws:
IOException - if i/o error occurs.

getMimeType

public abstract String getMimeType()
Returns the file MIME type.

Returns:
MIME type, never null.

getSize

public abstract long getSize()
Returns file size, in bytes.

Returns:
the file size.

fromUri

public static AbstractAudio fromUri(String fileUri)
Returns the audio object instance from a file denoted by given URI.

Parameters:
fileUri - the URI
Returns:
audio instance.


Copyright © 2007-2008. All Rights Reserved.