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 ParserUtil

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

    public final class ParserUtil

extends java.lang.Object

Utility methods for file parsers.

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

Method Summary
`static byte[]` | `checkUTF(byte[] data)` Checks if the given byte array only contains valid UTF-8 characters.
`static javax.xml.datatype.XMLGregorianCalendar` | `convertDate(java.util.Date date)` Converts a date value to an `XMLGregorianCalendar` instance.
`static javax.xml.datatype.Duration` | `convertDuration(byte[] value)` Checks if the value is of the form `mm:ss` or if it is a milliseconds value and returns a `Duration` instance.
`static javax.xml.datatype.Duration` | `convertMinSecDuration(byte[] minSec)` Converts a duration value of the form `mm:ss` to an `Duration` instance.
`static javax.xml.datatype.Duration` | `convertMsDuration(int milliseconds)` Converts a duration value in milliseconds to an `Duration` instance.
`static void` | `fireDateEvents(NewFSParser parser, Metadata meta, java.io.File file)` Writes the date values of the file to the parser.

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

Method Detail

### convertMsDuration

    public static javax.xml.datatype.Duration convertMsDuration(int milliseconds)

  Converts a duration value in milliseconds to an `Duration` instance.

  Parameters:
    `milliseconds` - the number of milliseconds to convert.
  Returns:
    the `Duration` instance or `null` if the conversion fails.

### convertDuration

    public static javax.xml.datatype.Duration convertDuration(byte[] value)

  Checks if the value is of the form `mm:ss` or if it is a milliseconds value and returns a `Duration` instance.

  Parameters:
    `value` - the byte array to convert.
  Returns:
    the `Duration` instance or `null` if the conversion fails.

### convertMinSecDuration

    public static javax.xml.datatype.Duration convertMinSecDuration(byte[] minSec)

  Converts a duration value of the form `mm:ss` to an `Duration` instance.

  Parameters:
    `minSec` - the byte array containing the duration value.
  Returns:
    the `Duration` instance or `null` if the conversion fails.

### convertDate

    public static javax.xml.datatype.XMLGregorianCalendar convertDate(java.util.Date date)

  Converts a date value to an `XMLGregorianCalendar` instance.

  Parameters:
    `date` - the `Date` value to convert.
  Returns:
    the `XMLGregorianCalendar` instance or `null` if the conversion fails.

### fireDateEvents

    public static void fireDateEvents(NewFSParser parser,
                                      Metadata meta,
                                      java.io.File file)
                               throws java.io.IOException

  Writes the date values of the file to the parser.

  Parameters:
    `parser` - the `NewFSParser` instance to fire `NewFSParser.metaEvent(Metadata)` events.
    `meta` - the metadata item to use.
    `file` - the file to read time values from.
  Throws:
    `java.io.IOException` - if any error occurs while writing to the parser.

### checkUTF

    public static byte[] checkUTF(byte[] data)

  Checks if the given byte array only contains valid UTF-8 characters. All invalid chars are replaced by spaces.

  Parameters:
    `data` - the byte array to check.
  Returns:
    a byte array containing only valid UTF-8 chars.

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