org.mmbase.util.magicfile
Class MagicParser
java.lang.Object
org.mmbase.util.magicfile.MagicParser
- All Implemented Interfaces:
- DetectorProvider
- public class MagicParser
- extends Object
- implements DetectorProvider
This Parser translates the configuration file of UNIX's file to a
list of Detectors (and to a magic.xml) Perhaps it's easier to
rewrite this stuff to perl or something like that.
- Version:
- $Id: MagicParser.java,v 1.10 2005/10/07 18:41:29 michiel Exp $
- To Do:
- NOT TESTED YET
|
Field Summary |
static String |
DEFAULT_MAGIC_FILE
the default files used to create the Detectors
DEFAULT_MAGIC_FILE = "/etc/mime-magic" |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_MAGIC_FILE
public static final String DEFAULT_MAGIC_FILE
- the default files used to create the Detectors
DEFAULT_MAGIC_FILE = "/etc/mime-magic"
- See Also:
- Constant Field Values
MagicParser
public MagicParser()
MagicParser
public MagicParser(String fileName)
- Construct a new MagicParser with configuration file
- Since:
- MMBase-1.7
getDetectors
public List getDetectors()
- Specified by:
getDetectors in interface DetectorProvider
nextWhiteSpace
protected int nextWhiteSpace(String s)
nextWhiteSpace
protected int nextWhiteSpace(String s,
int startIndex)
nextNonWhiteSpace
protected int nextNonWhiteSpace(String s,
int startIndex)
toXML
public boolean toXML(String path)
throws IOException
- Throws:
IOException
toXML
public boolean toXML(File f)
throws IOException
- Write the current datastructure to an XML file
- Throws:
IOException
main
public static void main(String[] argv)
throws IOException
- Throws:
IOException
MMBase build 1.8.1.20060716