APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.media.jfxmediaimpl

public Class MediaUtils

extends Object
Class Inheritance
Imports
com.sun.media.jfxmedia.MediaError, .MediaException, com.sun.media.jfxmedia.events.MediaErrorListener, com.sun.media.jfxmedia.locator.Locator, com.sun.media.jfxmedia.logging.Logger, java.net.URI, java.nio.file.Path, java.util.List, .ListIterator, java.lang.ref.WeakReference

Utility functions.

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
public static final int
MAX_FILE_SIGNATURE_LENGTH

Maximum number of bytes needed to scan the file signature.

pack-priv static final String
NATIVE_MEDIA_ERROR_FORMAT

Format of an error which occurred in the native porting layer.

pack-priv static final String
NATIVE_MEDIA_WARNING_FORMAT

Format of an error which occurred in the native porting layer.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
error(Object source, int errCode, String
The detail message.
message
,
Throwable
The cause.
cause
)

Throw a MediaException with the indicated message and cause.

public static String

Returns:

content type
filenameToContentType
(URI uri)

Returns the content type given the uri.

public static String

Returns:

The content type or Locator#DEFAULT_CONTENT_TYPE if not able to be determined or unsupported.
fileSignatureToContentType
(byte[]
File signature of size MAX_FILE_SIGNATURE_LENGTH
buf
,
int size)

Attempt to determine the content type from the file signature.

public static String

Returns:

file name or null if file name cannot be extracted
getFilenameFromURI
(URI uri)

Returns the file name given the uri.

public static void
nativeError(Object source, MediaError error)

Throw a MediaException with the indicated error code.

public static void
nativeWarning(Object source, int
The native warning code.
warningCode
,
String warningMessage)

Send a message with the indicated native error code.

public static void
warning(Object
the source of the warning, likely the object calling this method.
source
,
String
a String containing the warning.
message
)

Forward warnings to the global listeners registered with the NativeMediaManager.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONTENT_TYPE_AIFFback to summary
public static final String CONTENT_TYPE_AIFF
CONTENT_TYPE_FLVback to summary
public static final String CONTENT_TYPE_FLV
CONTENT_TYPE_JFXback to summary
public static final String CONTENT_TYPE_JFX
CONTENT_TYPE_M3Uback to summary
public static final String CONTENT_TYPE_M3U
CONTENT_TYPE_M3U8back to summary
public static final String CONTENT_TYPE_M3U8
CONTENT_TYPE_M4Aback to summary
public static final String CONTENT_TYPE_M4A
CONTENT_TYPE_M4Vback to summary
public static final String CONTENT_TYPE_M4V
CONTENT_TYPE_MP3back to summary
public static final String CONTENT_TYPE_MP3
CONTENT_TYPE_MP4back to summary
public static final String CONTENT_TYPE_MP4
CONTENT_TYPE_MPAback to summary
public static final String CONTENT_TYPE_MPA
CONTENT_TYPE_WAVback to summary
public static final String CONTENT_TYPE_WAV
FILE_TYPE_AIFback to summary
private static final String FILE_TYPE_AIF
FILE_TYPE_AIFFback to summary
private static final String FILE_TYPE_AIFF
FILE_TYPE_FLVback to summary
private static final String FILE_TYPE_FLV
FILE_TYPE_FXMback to summary
private static final String FILE_TYPE_FXM
FILE_TYPE_M3Uback to summary
private static final String FILE_TYPE_M3U
FILE_TYPE_M3U8back to summary
private static final String FILE_TYPE_M3U8
FILE_TYPE_M4Aback to summary
private static final String FILE_TYPE_M4A
FILE_TYPE_M4Vback to summary
private static final String FILE_TYPE_M4V
FILE_TYPE_MP4back to summary
private static final String FILE_TYPE_MP4
FILE_TYPE_MPAback to summary
private static final String FILE_TYPE_MPA
FILE_TYPE_WAVback to summary
private static final String FILE_TYPE_WAV
MAX_FILE_SIGNATURE_LENGTHback to summary
public static final int MAX_FILE_SIGNATURE_LENGTH

Maximum number of bytes needed to scan the file signature.

NATIVE_MEDIA_ERROR_FORMATback to summary
pack-priv static final String NATIVE_MEDIA_ERROR_FORMAT

Format of an error which occurred in the native porting layer. A single int argument representing an error code is expected.

NATIVE_MEDIA_WARNING_FORMATback to summary
pack-priv static final String NATIVE_MEDIA_WARNING_FORMAT

Format of an error which occurred in the native porting layer. A single int argument representing a warning code is expected.

Note

FLV related code in this file is needed so we can provide error message that FLV support is removed.

Constructor Detail

MediaUtilsback to summary
public MediaUtils()

Method Detail

errorback to summary
public static void error(Object source, int errCode, String message, Throwable cause)

Throw a MediaException with the indicated message and cause. This method should be invoked only from the Java layer. The is logged before the exception is thrown.

Parameters
message:String

The detail message.

cause:Throwable

The cause.

filenameToContentTypeback to summary
public static String filenameToContentType(URI uri)

Returns the content type given the uri.

Returns:String

content type

fileSignatureToContentTypeback to summary
public static String fileSignatureToContentType(byte[] buf, int size) throws MediaException

Attempt to determine the content type from the file signature.

Parameters
buf:byte[]

File signature of size MAX_FILE_SIGNATURE_LENGTH

Returns:String

The content type or Locator#DEFAULT_CONTENT_TYPE if not able to be determined or unsupported.

getFilenameFromURIback to summary
public static String getFilenameFromURI(URI uri)

Returns the file name given the uri. Supports special case for JAR URIs.

Returns:String

file name or null if file name cannot be extracted

nativeErrorback to summary
public static void nativeError(Object source, MediaError error)

Throw a MediaException with the indicated error code. This method should be invoked only from the native layer.

nativeWarningback to summary
public static void nativeWarning(Object source, int warningCode, String warningMessage)

Send a message with the indicated native error code.

Parameters
warningCode:int

The native warning code.

warningback to summary
public static void warning(Object source, String message)

Forward warnings to the global listeners registered with the NativeMediaManager. This method may be invoked from either the Java or the native layer.

Parameters
source:Object

the source of the warning, likely the object calling this method.

message:String

a String containing the warning.