FileDocCategorySizeDatePackage
ContentDescriptor.javaAPI DocJMF 2.1.1e3788Mon May 12 12:20:40 BST 2003javax.media.protocol

ContentDescriptor

public class ContentDescriptor extends Format
A ContentDescriptor identifies media data containers.
see
SourceStream
see
javax.media.Format
since
JMF 1.0, extends Format in JMF 2.0

Fields Summary
public static final String
RAW
RAW content type. This signifies content that's contained in individual buffers of type Buffer and carries any format of media as specified by the format attribute of the buffer.
public static final String
RAW_RTP
RAW RTP content type. This is similar to the RAW content type but only carries buffers that contain packetized data formats supported by RTP.
public static final String
MIXED
Mixed content type. This signifies content that contains other elementary content types. e.g., when more than one DataSources is merged to formed one DataSource, the resulting DataSource may contain mixed contents.
public static final String
CONTENT_UNKNOWN
Unknown content type
Constructors Summary
public ContentDescriptor(String cdName)
Create a content descriptor with the specified name.

To create a ContentDescriptor from a MIME type, use the mimeTypeToPackageName static member.

param
cdName The name of the content-type.

	super(cdName);
    
Methods Summary
public java.lang.StringgetContentType()
Obtain a string that represents the content-name for this descriptor.

return
The content-type name.



                       
       
	return getEncoding();
    
public static final java.lang.StringmimeTypeToPackageName(java.lang.String mimeType)
Map a MIME content-type to an equivalent string of class-name components.

The MIME type is mapped to a string by:

  1. Replacing all slashes with a period.
  2. Converting all alphabetic characters to lower case.
  3. Converting all non-alpha-numeric characters other than periods to underscores (_).

For example, "text/html" would be converted to "text.html"

param
mimeType The MIME type to map to a string.


	if (mimeType == null)
	    return null;

	// All to lower case ...
	mimeType = mimeType.toLowerCase();

	// ... run through each char and convert
	//            '/'                ->  '.'
	//             !([A-Za-z0--9])   ->  '_'
	int len = mimeType.length();
	char nm[] = new char[len];
	mimeType.getChars(0, len, nm, 0);
	for (int i = 0; i < len; i++) {
	    char c = nm[i];
	    if (c == '/") {
		nm[i] = '.";
	    } else if (!(c == '." ||
			'A" <= c && c <= 'Z" ||
		        'a" <= c && c <= 'z" ||
		        '0" <= c && c <= '9")) {
		nm[i] = '_";
	    }
	}
	
	return new String(nm);
    
public java.lang.StringtoString()
Returns a string which describes the format parameters.

return
a string which describes the format parameters.

	if (encoding.equalsIgnoreCase(RAW))
	    return "RAW";
	else if (encoding.equalsIgnoreCase(RAW_RTP))
	    return "RAW/RTP";
	else if (encoding.equalsIgnoreCase("audio.cdaudio"))
	    return "CD Audio";
	else
	    return encoding;