org.apache.commons.imaging.common.bytesource

## Class ByteSource

- java.lang.Object
- - org.apache.commons.imaging.common.bytesource.ByteSource

- Direct Known Subclasses:
    ByteSourceArray, ByteSourceFile, ByteSourceInputStream

      public abstract class ByteSource
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteSource(String fileName)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract byte[]` | `getAll()`
    `byte[]` | `getBlock(int start, int length)`
    `abstract byte[]` | `getBlock(long start, int length)`
    `abstract String` | `getDescription()`
    `String` | `getFileName()`
    `abstract InputStream` | `getInputStream()`
    `InputStream` | `getInputStream(long start)`
    `abstract long` | `getLength()` This operation can be VERY expensive; for inputstream byte sources, the entire stream must be drained to determine its length.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ByteSource

          public ByteSource(String fileName)

  - ### Method Detail

    - #### getInputStream

          public final InputStream getInputStream(long start)
                                           throws IOException

      Throws:
        `IOException`

    - #### getInputStream

          public abstract InputStream getInputStream()
                                              throws IOException

      Throws:
        `IOException`

    - #### getBlock

          public byte[] getBlock(int start,
                                 int length)
                          throws IOException

      Throws:
        `IOException`

    - #### getBlock

          public abstract byte[] getBlock(long start,
                                          int length)
                                   throws IOException

      Throws:
        `IOException`

    - #### getAll

          public abstract byte[] getAll()
                                 throws IOException

      Throws:
        `IOException`

    - #### getLength

          public abstract long getLength()
                                  throws IOException

      This operation can be VERY expensive; for inputstream byte sources, the entire stream must be drained to determine its length.
      Returns:
        the byte source length
      Throws:
        `IOException` - if it fails to read the byte source data

    - #### getDescription

          public abstract String getDescription()

    - #### getFileName

          public final String getFileName()

Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.