Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.build.fs.parser
Class AbstractParser

    java.lang.Object
      org.basex.build.fs.parser.AbstractParser

Direct Known Subclasses:
  JPGParser, KMLParser, MP3Parser, PNGParser, TXTParser, XMLParser

    public abstract class AbstractParser

extends java.lang.Object

Abstract class for metadata extractors / file parsers.

Author:
  Workgroup DBIS, University of Konstanz 2005-09, ISC License, Bastian Lemke

Method Summary
`abstract boolean` | `check(BufferedFileChannel bfc)` Checks if there is a File in correct format and can be read by the parser.
`abstract void` | `readContent(BufferedFileChannel bfc, NewFSParser parser)` Reads the textual content from a `FileChannel` and fires events.
`void` | `readMeta(BufferedFileChannel bfc, NewFSParser parser)` Reads the metadata from a `BufferedFileChannel` and fires events for each key/value pair.
`void` | `readMetaAndContent(BufferedFileChannel bfc, NewFSParser parser)` Reads metadata and content from a `BufferedFileChannel` and fires events for each key-value pair.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### check

    public abstract boolean check(BufferedFileChannel bfc)
                           throws java.io.IOException

  Checks if there is a File in correct format and can be read by the parser. Checks e.g. header bytes.

  Parameters:
    `bfc` - the `BufferedFileChannel` to read from.
  Returns:
    true if the file is supported.
  Throws:
    `java.io.IOException` - if an error occurs while reading from the file.

### readMeta

    public void readMeta(BufferedFileChannel bfc,
                         NewFSParser parser)
                  throws java.io.IOException

  Reads the metadata from a `BufferedFileChannel` and fires events for each key/value pair.

  Parameters:
    `bfc` - `BufferedFileChannel` to read from.
    `parser` - the `NewFSParser` instance to fire events.
  Throws:
    `java.io.IOException` - if any error occurs while reading from the file.
  See Also:
    `NewFSParser.metaEvent(Metadata)`

### readMetaAndContent

    public void readMetaAndContent(BufferedFileChannel bfc,
                                   NewFSParser parser)
                            throws java.io.IOException

  Reads metadata and content from a `BufferedFileChannel` and fires events for each key-value pair.

  Does the same as the two method calls:

       readMeta(BufferedFileChannel, NewFSParser);
       readContent(BufferedFileChannel, NewFSParser);

  but is potentially much more efficient (depends on the actual parser implementation).

  The order of the fired elements may differ from the two separate method calls.

  Parameters:
    `bfc` - the `BufferedFileChannel` to read from.
    `parser` - the `NewFSParser` instance to write the content to.
  Throws:
    `java.io.IOException` - if any error occurs while reading from the file.

### readContent

    public abstract void readContent(BufferedFileChannel bfc,
                                     NewFSParser parser)
                              throws java.io.IOException

  Reads the textual content from a `FileChannel` and fires events.

  Parameters:
    `bfc` - the `BufferedFileChannel` to read from.
    `parser` - the `NewFSParser` instance to write the content to.
  Throws:
    `java.io.IOException` - if any error occurs while reading from the file.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD