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)
- Version:
- $Id: MagicParser.java 41710 2010-04-01 08:58:34Z michiel $
|
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
- Parameters:
fileName - File which contains the magic data- Since:
- MMBase-1.7
getDetectors
public List<Detector> 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 data structure to an XML file
- Parameters:
f - File to write to
- Returns:
- written successful or not
- Throws:
IOException - Throws an exception when parsing failed
main
public static void main(String[] argv)
throws IOException
- Throws:
IOException
MMBase 2.0-SNAPSHOT - null