javax.media
类 Format

java.lang.Object
  继承者 javax.media.Format
所有已实现的接口:
java.io.Serializable, java.lang.Cloneable

public class Format
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A Format abstracts an exact media format. It carries no encoding-specific parameters or timing information global to the presentation.

Comparing different formats

Not all of the attributes in a Format object have to be specified. This enables selected attributes to be specified, making it possible to locate a supported Format that meets certain requirements without needing to find an exact match.

Two methods are provided for comparing Formats. The equals method returns true if two Format objects are exactly the same--they're the same type and all of their attributes are the same. The matches method relaxes the comparison, comparing only the attributes that are explicitly specified in the Format you are comparing.

从以下版本开始:
JMF 2.0
另请参见:
序列化表格

字段摘要
static java.lang.Class byteArray
          The data object required by the Format is a byte array.
protected  java.lang.Class clz
           
protected  java.lang.Class dataType
           
protected  java.lang.String encoding
           
static int FALSE
           
static java.lang.Class formatArray
          The data object required by the Format is an array of Format objects.
static java.lang.Class intArray
          The data object required by the Format is an integer array.
static int NOT_SPECIFIED
           
static java.lang.Class shortArray
          The data object required by the Format is a short array.
static int TRUE
           
 
构造方法摘要
Format(java.lang.String encoding)
          Constructs a Format that has the specified encoding type.
Format(java.lang.String encoding, java.lang.Class dataType)
          Constructs a Format that has the specified encoding and data types.
 
方法摘要
 java.lang.Object clone()
          Creates a clone of this Format.
protected  void copy(Format f)
          Copies the attributes from the specified Format into this Format.
 boolean equals(java.lang.Object format)
          Checks whether or not the specified Format is the same as this Format.
 java.lang.Class getDataType()
          Gets the type of the data that this Format requires.
 java.lang.String getEncoding()
          Gets the uniquely-qualified encoding name for this Format.
 Format intersects(Format other)
          Intersects the attributes of this format and the specified format to create a new Format object.
 boolean isSameEncoding(Format other)
          Checks if the encodings of both format objects are the same.
 boolean isSameEncoding(java.lang.String encoding)
          Checks if the encoding of this format is same as the parameter.
 boolean matches(Format format)
          Checks whether or not the specified Format matches this Format.
 Format relax()
          Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
 java.lang.String toString()
          Gets a String representation of the Format attributes.
 
从类 java.lang.Object 继承的方法
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

NOT_SPECIFIED

public static final int NOT_SPECIFIED
另请参见:
常量字段值

TRUE

public static final int TRUE
另请参见:
常量字段值

FALSE

public static final int FALSE
另请参见:
常量字段值

encoding

protected java.lang.String encoding

intArray

public static final java.lang.Class intArray
The data object required by the Format is an integer array.


shortArray

public static final java.lang.Class shortArray
The data object required by the Format is a short array.


byteArray

public static final java.lang.Class byteArray
The data object required by the Format is a byte array.


formatArray

public static final java.lang.Class formatArray
The data object required by the Format is an array of Format objects.


dataType

protected java.lang.Class dataType

clz

protected java.lang.Class clz
构造方法详细信息

Format

public Format(java.lang.String encoding)
Constructs a Format that has the specified encoding type.

参数:
encoding - A String that contains the encoding type of the Format to be constructed.

Format

public Format(java.lang.String encoding,
              java.lang.Class dataType)
Constructs a Format that has the specified encoding and data types.

参数:
encoding - A String that contains the encoding type of the Format to be constructed.
dataType - The type of data object required by the Format to be constructed, such as: byteArray, intArray, or shortArray. For example, for a byte array the data type would be "Format.byteArray".
方法详细信息

getEncoding

public java.lang.String getEncoding()
Gets the uniquely-qualified encoding name for this Format.

In the reference implementation of JMF, these strings follow the QuickTime codec strings.

返回:
The encoding of the Format.

getDataType

public java.lang.Class getDataType()
Gets the type of the data that this Format requires. For example, for byte array it returns "byte[].class".

返回:
The data type of this Format.

equals

public boolean equals(java.lang.Object format)
Checks whether or not the specified Format is the same as this Format. To be equal, the two Formats must be of the same type and all of their attributes must be the same.

覆盖:
java.lang.Object 中的 equals
参数:
format - The Format to compare with this one.
返回:
true if the specified Format is the same as this one, false if it is not.

matches

public boolean matches(Format format)
Checks whether or not the specified Format matches this Format. Matches only compares the attributes that are defined in the specified Format, unspecified attributes are ignored.

The two Format objects do not have to be of the same class to match. For example, if "A" are "B" are being compared, a match is possible if "A" is derived from "B" or "B" is derived from "A". (The compared attributes must still match, or matches fails.)

参数:
format - The Format to compare with this one.
返回:
true if the specified Format matches this one, false if it does not.

intersects

public Format intersects(Format other)
Intersects the attributes of this format and the specified format to create a new Format object. The two objects being intersected should either be of the same type or one should be a subclass of the other. The resulting object will be the same type as the subclass.

Common attributes are intersected as follows: If both objects have NOT_SPECIFIED values for an attribute, the result will also have a NOT_SPECIFIED value. If one of them has a NOT_SPECIFIED value then the result will have the value that is specified in the other object. If both objects have specified values then the value in this object will be used.

Attributes that are specific to the subclass will be carried forward to the result.

参数:
other - The Format object to intersect with this Format.
返回:
A Format object with its attributes set to those attributes common to both Format objects.
另请参见:
matches(javax.media.Format)

isSameEncoding

public boolean isSameEncoding(Format other)
Checks if the encodings of both format objects are the same. Its faster than calling String.equalsIgnoreCase to compare the two encodings.

返回:
true if the encodings are the same, false otherwise.

isSameEncoding

public boolean isSameEncoding(java.lang.String encoding)
Checks if the encoding of this format is same as the parameter. Its faster than calling String.equalsIgnoreCase to compare the two encodings.

返回:
true if the encodings are the same, false otherwise.

relax

public Format relax()
Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.

返回:
A Format that's less restrictive than the this format.

clone

public java.lang.Object clone()
Creates a clone of this Format.

覆盖:
java.lang.Object 中的 clone
返回:
A clone of this format.

copy

protected void copy(Format f)
Copies the attributes from the specified Format into this Format.

参数:
f - The Format to copy the attributes from.

toString

public java.lang.String toString()
Gets a String representation of the Format attributes. For example: "PCM, 44.1 KHz, Stereo, Signed".

覆盖:
java.lang.Object 中的 toString
返回:
A String that describes the Format attributes.