|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jimi.util.DataType
This class provides a data type identification in the form of a string. Clients of this class are responsible for mapping that identifier string to something useful.
If the getID(InputStream is) method is used then the client is responsible for passing an input stream which can be reset to restore the data consumed by this class in an attempt to identify the specified source.
Currently this class currently only supports type identification via filename extension.
PROJECTED OPERATION IS BELOW This class retreives data from the designated source and checks for matches against expressions stored in a configuration file to locate the file ID. See external specification for format of the file and field contents etc.
The configuration file is an ascii text file which is currently maintained by editing the file with a text editor. This will change in the future to allow applications to register there own fileTypes and expressions for specific clients.
Field Summary | |
static int |
MAX_REWIND
This is the maximum number of bytes that this class will take to identify file in any situation. |
Constructor Summary | |
DataType()
|
|
DataType(java.lang.String client)
This constructor will find the highes version ID for the client. |
|
DataType(java.lang.String client,
int version)
|
Method Summary | |
protected static java.lang.String |
getExtension(java.lang.String str)
|
static java.lang.String |
getID(java.io.InputStream is)
|
static java.lang.String |
getID(java.lang.String fileName)
currently just calls getIDe() to ID files by filename extension |
static java.lang.String |
getID(java.net.URL url)
currently just calls getIDe() to ID files by filename extension |
static java.lang.String |
getIDe(java.lang.String fileName)
|
static java.lang.String |
getIDe(java.net.URL url)
|
static void |
putMapping(java.lang.String extension,
java.lang.String typeID)
Add or Overide a mapping of filename extension to String type. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static int MAX_REWIND
Constructor Detail |
public DataType(java.lang.String client, int version)
client
- ID of the client for which file ID is required.version
- the version of the client for which the ID is required.public DataType(java.lang.String client)
client
- ID of the client for which file ID is required.public DataType()
Method Detail |
public static void putMapping(java.lang.String extension, java.lang.String typeID)
extension
- filename extensiontypeID
- id string of the type of the file to be returned for
filenames with the assocciatted extension.protected static java.lang.String getExtension(java.lang.String str)
public static java.lang.String getIDe(java.lang.String fileName)
public static java.lang.String getIDe(java.net.URL url)
getIDe
public static java.lang.String getID(java.lang.String fileName) throws java.io.IOException
public static java.lang.String getID(java.net.URL url) throws java.io.IOException
public static java.lang.String getID(java.io.InputStream is) throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |