net.sf.fmj.utility
Class FormatArgUtils

java.lang.Object
  extended by net.sf.fmj.utility.FormatArgUtils

public class FormatArgUtils
extends java.lang.Object

A class for converting Format objects to and from strings that can be used as arguments in command-line programs, or as parameters in URLs. The syntax is this: all elements are separated by a colon. Everything is uppercase by default, but case is ignored. Only thing that is lowercase is x in dimension. Generally, each item corresponds to a constructor argument. The Format subclass is inferred from the encoding. ? is used to indicate Format.NOT_SPECIFIED (-1). floating point values in audio formats are done as integers. In audio formats, Big endian is B, little endian is L, signed is S, unsigned is U Data types: B is byte[], S is short[], I is int[] Dimension: [width]x[height], like "640x480" Trailing not specified values may be omitted. new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2) would be LINEAR:44100:16:2 TODO: support WavAudioFormat, video formats, and other missing audio formats.

Author:
Ken Larson

Field Summary
static java.lang.String BIG_ENDIAN
           
static java.lang.String BYTE_ARRAY
           
static java.lang.String INT_ARRAY
           
static java.lang.String LITTLE_ENDIAN
           
static java.lang.String NOT_SPECIFIED
           
static java.lang.String SHORT_ARRAY
           
static java.lang.String SIGNED
           
static java.lang.String UNSIGNED
           
 
Constructor Summary
FormatArgUtils()
           
 
Method Summary
static Format parse(java.lang.String s)
           
static java.lang.String toString(Format f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_ARRAY

public static final java.lang.String BYTE_ARRAY
See Also:
Constant Field Values

SHORT_ARRAY

public static final java.lang.String SHORT_ARRAY
See Also:
Constant Field Values

INT_ARRAY

public static final java.lang.String INT_ARRAY
See Also:
Constant Field Values

NOT_SPECIFIED

public static final java.lang.String NOT_SPECIFIED
See Also:
Constant Field Values

BIG_ENDIAN

public static final java.lang.String BIG_ENDIAN
See Also:
Constant Field Values

LITTLE_ENDIAN

public static final java.lang.String LITTLE_ENDIAN
See Also:
Constant Field Values

SIGNED

public static final java.lang.String SIGNED
See Also:
Constant Field Values

UNSIGNED

public static final java.lang.String UNSIGNED
See Also:
Constant Field Values
Constructor Detail

FormatArgUtils

public FormatArgUtils()
Method Detail

toString

public static java.lang.String toString(Format f)

parse

public static Format parse(java.lang.String s)
                    throws java.text.ParseException
Throws:
java.text.ParseException