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.source
Class ByteArrayDocumentSource

    java.lang.Object
      org.apache.any23.source.ByteArrayDocumentSource

All Implemented Interfaces:
  DocumentSource

    public class ByteArrayDocumentSource

extends Object
implements DocumentSource

ByteArray implementation of `DocumentSource`.

Author:
  Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
`ByteArrayDocumentSource(byte[] bytes, String documentURI, String contentType)`
`ByteArrayDocumentSource(InputStream inputStream, String documentURI, String contentType)`

Method Summary
`long` | `getContentLength()`
`String` | `getContentType()`
`String` | `getDocumentURI()`
`boolean` | `isLocal()` A value of `false` indicates that the document resides remotely, and that multiple successive accesses to it should be avoided by copying it to local storage.
`InputStream` | `openInputStream()` Returns the input stream for accessing the content of the document.

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

Constructor Detail

### ByteArrayDocumentSource

    public ByteArrayDocumentSource(byte[] bytes,
                                   String documentURI,
                                   String contentType)

### ByteArrayDocumentSource

    public ByteArrayDocumentSource(InputStream inputStream,
                                   String documentURI,
                                   String contentType)
                            throws IOException

Throws:
  `IOException`

Method Detail

### openInputStream

    public InputStream openInputStream()
                                throws IOException

  Description copied from interface: `DocumentSource`
  Returns the input stream for accessing the content of the document.

  Specified by:
    `openInputStream` in interface `DocumentSource`
  Returns:
    not `null` input stream for accessing document data.
  Throws:
    `IOException`

### getContentLength

    public long getContentLength()

  Specified by:
    `getContentLength` in interface `DocumentSource`
  Returns:
    the size of the content length in bytes.

### getDocumentURI

    public String getDocumentURI()

  Specified by:
    `getDocumentURI` in interface `DocumentSource`
  Returns:
    the actual, final, canonical URI if redirects occur.

### getContentType

    public String getContentType()

  Specified by:
    `getContentType` in interface `DocumentSource`
  Returns:
    a string describing the content type of the provided document.

### isLocal

    public boolean isLocal()

  Description copied from interface: `DocumentSource`
  A value of `false` indicates that the document resides remotely, and that multiple successive accesses to it should be avoided by copying it to local storage. This can also be used for sources that do not support multiple calls to `DocumentSource.openInputStream()`.

  Specified by:
    `isLocal` in interface `DocumentSource`

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.