net.rim.pushsdk.commons.content
Class MpegAudioContent

java.lang.Object
  extended by net.rim.pushsdk.commons.content.Content
      extended by net.rim.pushsdk.commons.content.SinglePartContent
          extended by net.rim.pushsdk.commons.content.BinaryContent
              extended by net.rim.pushsdk.commons.content.MpegAudioContent

public class MpegAudioContent
extends BinaryContent

Represents MPEG audio content. The content-type header is set to audio/mpeg.

Author:
mdandrea

Field Summary
 
Fields inherited from class net.rim.pushsdk.commons.content.BinaryContent
CONTENT_TRANSFER_ENCODING_BASE64, CONTENT_TRANSFER_ENCODING_BINARY
 
Fields inherited from class net.rim.pushsdk.commons.content.Content
BOUNDARY_DELIMITER_BYTES, contentType, headers, NEW_LINE, NEW_LINE_BYTES
 
Constructor Summary
MpegAudioContent(byte[] content, boolean shouldBase64Encode)
          Constructs an MPEG audio with the specified content.
MpegAudioContent(File file, boolean shouldBase64Encode)
          Constructs an MPEG audio from the specified file.
MpegAudioContent(URL url, boolean shouldBase64Encode)
          Constructs an MPEG audio from the specified URL.
 
Method Summary
protected  void checkExtension(String string)
          Verifies that the audio ends in the .mpg, .mpeg, .mpa, .mp1, .m1a, .mp2, .m2a, or .mp3 file extension.
 String toString()
          Constructs a String with all attributes in name = value format.
 
Methods inherited from class net.rim.pushsdk.commons.content.BinaryContent
isEmpty, writeContentTo
 
Methods inherited from class net.rim.pushsdk.commons.content.SinglePartContent
getBytesFromFile, getBytesFromURL, writeTo
 
Methods inherited from class net.rim.pushsdk.commons.content.Content
addHeader, getContentType, getHeader, getHeaders, setContentType, setHeader, writeHeadersTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MpegAudioContent

public MpegAudioContent(byte[] content,
                        boolean shouldBase64Encode)
Constructs an MPEG audio with the specified content. The audio is base64 encoded if requested.

Parameters:
content - the MPEG audio content
shouldBase64Encode - true if the content should be base64 encoded; false otherwise

MpegAudioContent

public MpegAudioContent(File file,
                        boolean shouldBase64Encode)
                 throws IOException
Constructs an MPEG audio from the specified file. The audio is base64 encoded if requested.

Parameters:
file - the MPEG audio file
shouldBase64Encode - true if the content should be base64 encoded; false otherwise
Throws:
IOException - if any IO errors occur reading from the file

MpegAudioContent

public MpegAudioContent(URL url,
                        boolean shouldBase64Encode)
                 throws IOException
Constructs an MPEG audio from the specified URL. The audio is base64 encoded if requested.

Parameters:
url - the MPEG audio URL
shouldBase64Encode - true if the content should be base64 encoded; false otherwise
Throws:
IOException - if any IO errors occur reading from the URL
Method Detail

checkExtension

protected void checkExtension(String string)
Verifies that the audio ends in the .mpg, .mpeg, .mpa, .mp1, .m1a, .mp2, .m2a, or .mp3 file extension.

Overrides:
checkExtension in class SinglePartContent
Parameters:
string - the file name

toString

public String toString()
Constructs a String with all attributes in name = value format.

Overrides:
toString in class BinaryContent
Returns:
a String representation of this object.


Copyright © 2011 Research In Motion. All Rights Reserved.