org.apache.poi.poifs.nio

## Class DataSource

- java.lang.Object
- - org.apache.poi.poifs.nio.DataSource

- Direct Known Subclasses:
    ByteArrayBackedDataSource, FileBackedDataSource

      public abstract class DataSource
      extends java.lang.Object

  Common definition of how we read and write bytes

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataSource()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `close()` Close the underlying stream
    `abstract void` | `copyTo(java.io.OutputStream stream)` Copies the contents to the specified OutputStream
    `abstract java.nio.ByteBuffer` | `read(int length, long position)`
    `abstract long` | `size()`
    `abstract void` | `write(java.nio.ByteBuffer src, long position)`

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

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

- - ### Constructor Detail

    - #### DataSource

          public DataSource()

  - ### Method Detail

    - #### read

          public abstract java.nio.ByteBuffer read(int length,
                                                   long position)
                                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public abstract void write(java.nio.ByteBuffer src,
                                     long position)
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### size

          public abstract long size()
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### close

          public abstract void close()
                              throws java.io.IOException

      Close the underlying stream
      Throws:
        `java.io.IOException`

    - #### copyTo

          public abstract void copyTo(java.io.OutputStream stream)
                               throws java.io.IOException

      Copies the contents to the specified OutputStream
      Throws:
        `java.io.IOException`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.