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.apache.any23.mime
Class TikaMIMETypeDetector

    java.lang.Object
      org.apache.any23.mime.TikaMIMETypeDetector

All Implemented Interfaces:
  MIMETypeDetector

    public class TikaMIMETypeDetector

extends Object
implements MIMETypeDetector

Implementation of `MIMETypeDetector` based on Apache Tika.

Author:
  Michele Mostarda (michele.mostarda@gmail.com), Davide Palmisano (dpalmisano@gmail.com)

Field Summary
`static String` | `CSV_MIMETYPE`
`static String` | `N3_MIMETYPE`
`static String` | `NQUADS_MIMETYPE`
`static String` | `RESOURCE_NAME`
`static String` | `TURTLE_MIMETYPE`

Constructor Summary
`TikaMIMETypeDetector()`
`TikaMIMETypeDetector(Purifier purifier)`

Method Summary
`static boolean` | `checkCSVFormat(InputStream is)` Checks if the stream contains a valid CSV pattern.
`static boolean` | `checkN3Format(InputStream is)` Checks if the stream contains the N3 triple patterns.
`static boolean` | `checkNQuadsFormat(InputStream is)` Checks if the stream contains the NQuads patterns.
`static boolean` | `checkTurtleFormat(InputStream is)` Checks if the stream contains Turtle triple patterns.
`MIMEType` | `guessMIMEType(String fileName, InputStream input, MIMEType mimeTypeFromMetadata)` Estimates the `MIME` type of the content of input file.

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

Field Detail

### N3_MIMETYPE

    public static final String N3_MIMETYPE

See Also:
  Constant Field Values

### NQUADS_MIMETYPE

    public static final String NQUADS_MIMETYPE

See Also:
  Constant Field Values

### TURTLE_MIMETYPE

    public static final String TURTLE_MIMETYPE

See Also:
  Constant Field Values

### CSV_MIMETYPE

    public static final String CSV_MIMETYPE

See Also:
  Constant Field Values

### RESOURCE_NAME

    public static final String RESOURCE_NAME

See Also:
  Constant Field Values

Constructor Detail

### TikaMIMETypeDetector

    public TikaMIMETypeDetector(Purifier purifier)

### TikaMIMETypeDetector

    public TikaMIMETypeDetector()

Method Detail

### checkN3Format

    public static boolean checkN3Format(InputStream is)
                                 throws IOException

  Checks if the stream contains the N3 triple patterns.

  Parameters:
    `is` - input stream to be verified.
  Returns:
    `true` if N3 patterns are detected, `false` otherwise.
  Throws:
    `IOException`

### checkNQuadsFormat

    public static boolean checkNQuadsFormat(InputStream is)
                                     throws IOException

  Checks if the stream contains the NQuads patterns.

  Parameters:
    `is` - input stream to be verified.
  Returns:
    `true` if N3 patterns are detected, `false` otherwise.
  Throws:
    `IOException`

### checkTurtleFormat

    public static boolean checkTurtleFormat(InputStream is)
                                     throws IOException

  Checks if the stream contains Turtle triple patterns.

  Parameters:
    `is` - input stream to be verified.
  Returns:
    `true` if Turtle patterns are detected, `false` otherwise.
  Throws:
    `IOException`

### checkCSVFormat

    public static boolean checkCSVFormat(InputStream is)
                                  throws IOException

  Checks if the stream contains a valid CSV pattern.

  Parameters:
    `is` - input stream to be verified.
  Returns:
    `true` if CSV patterns are detected, `false` otherwise.
  Throws:
    `IOException`

### guessMIMEType

    public MIMEType guessMIMEType(String fileName,
                                  InputStream input,
                                  MIMEType mimeTypeFromMetadata)

  Estimates the `MIME` type of the content of input file. The input stream must be resettable.

  Specified by:
    `guessMIMEType` in interface `MIMETypeDetector`
  Parameters:
    `fileName` - name of the data source.
    `input` - `null` or a resettable input stream containing data.
    `mimeTypeFromMetadata` - mimetype declared in metadata.
  Returns:
    the supposed mime type or `null` if nothing appropriate found.
  Throws:
    `IllegalArgumentException` - if input is not `null` and is not resettable.

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

Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.