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.writer
Class WriterRegistry

    java.lang.Object
      org.apache.any23.writer.WriterRegistry

    public class WriterRegistry

extends Object

Registry class for `FormatWriter`s.

Author:
  Michele Mostarda (mostarda@fbk.eu)

Method Summary
`static String` | `getIdentifier(Class<? extends FormatWriter> writerClass)` Reads the identifier specified for the given `FormatWriter`.
`String[]` | `getIdentifiers()`
`static WriterRegistry` | `getInstance()`
`static String` | `getMimeType(Class<? extends FormatWriter> writerClass)` Reads the MIME Type specified for the given `FormatWriter`.
`String[]` | `getMimeTypes()`
`Class<? extends FormatWriter>` | `getWriterByIdentifier(String id)` Returns the `FormatWriter` identified by `id`.
`FormatWriter` | `getWriterInstanceByIdentifier(String id, OutputStream os)` Returns an instance of `FormatWriter` ready to write on the given `os` `OutputStream`.
`Class<? extends FormatWriter>[]` | `getWriters()`
`Class<? extends FormatWriter>[]` | `getWritersByMimeType(String mimeType)` Returns all the writers matching the specified `mimeType`.
`boolean` | `hasIdentifier(String id)` Verifies if a `FormatWriter` with given `id` identifier has been registered.
`void` | `register(Class<? extends FormatWriter> writerClass)` Registers a new `FormatWriter` to the registry.

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

Method Detail

### getIdentifier

    public static String getIdentifier(Class<? extends FormatWriter> writerClass)

  Reads the identifier specified for the given `FormatWriter`.

  Parameters:
    `writerClass` - writer class.
  Returns:
    identifier.

### getMimeType

    public static String getMimeType(Class<? extends FormatWriter> writerClass)

  Reads the MIME Type specified for the given `FormatWriter`.

  Parameters:
    `writerClass` - writer class.
  Returns:
    MIME type.

### getInstance

    public static WriterRegistry getInstance()

  Returns:
    the `WriterRegistry` singleton instance.

### register

    public void register(Class<? extends FormatWriter> writerClass)

  Registers a new `FormatWriter` to the registry.

  Parameters:
    `writerClass` - the class of the writer to be registered.
  Throws:
    `IllegalArgumentException` - if the id or the mimetype are null or empty strings or if the identifier has been already defined.

### hasIdentifier

    public boolean hasIdentifier(String id)

  Verifies if a `FormatWriter` with given `id` identifier has been registered.

  Parameters:
    `id` - identifier.
  Returns:
    `true` if the identifier has been registered, `false` otherwise.

### getIdentifiers

    public String[] getIdentifiers()

  Returns:
    the list of all the specified identifiers.

### getMimeTypes

    public String[] getMimeTypes()

  Returns:
    the list of MIME types covered by the registered `FormatWriter`s.

### getWriters

    public Class<? extends FormatWriter>[] getWriters()

  Returns:
    the list of all the registered `FormatWriter`s.

### getWriterByIdentifier

    public Class<? extends FormatWriter> getWriterByIdentifier(String id)

  Returns the `FormatWriter` identified by `id`.

  Parameters:
    `id` - the writer identifier.
  Returns:
    the class of the `FormatWriter` matching the `id` or `null` if not found.s

### getWritersByMimeType

    public Class<? extends FormatWriter>[] getWritersByMimeType(String mimeType)

  Returns all the writers matching the specified `mimeType`.

  Parameters:
    `mimeType` - a MIMEType.
  Returns:
    a list of matching writers or an empty list.

### getWriterInstanceByIdentifier

    public FormatWriter getWriterInstanceByIdentifier(String id,
                                                      OutputStream os)

  Returns an instance of `FormatWriter` ready to write on the given `os` `OutputStream`.

  Parameters:
    `id` - the identifier of the `FormatWriter` to crate an instance.
    `os` - the output stream.
  Returns:
    the not `null` `FormatWriter` instance.
  Throws:
    `NullPointerException` - if the `id` doesn't match any registered writer.

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.