loci.formats.services

## Class POIServiceImpl

- java.lang.Object
- - loci.common.services.AbstractService
  - - loci.formats.services.POIServiceImpl

- All Implemented Interfaces:
    loci.common.services.Service, POIService

      public class POIServiceImpl
      extends loci.common.services.AbstractService
      implements POIService

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.util.Vector<java.lang.String>` | `filePath`
    `private java.util.Hashtable<java.lang.String,loci.poi.poifs.filesystem.DocumentEntry>` | `files`
    `private java.util.Hashtable<java.lang.String,java.lang.Integer>` | `fileSizes`
    `private loci.poi.poifs.filesystem.POIFSFileSystem` | `fileSystem`
    `private static int` | `MAX_BLOCK_SIZE`
    `static int` | `POI_MAGIC_BYTES`
    `private loci.poi.poifs.filesystem.DirectoryEntry` | `root`
    `private loci.common.RandomAccessInputStream` | `stream`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `POIServiceImpl()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the current POI file system.
    `byte[]` | `getDocumentBytes(java.lang.String file)` Retrieve all of the raw bytes that correspond to the given file name.
    `byte[]` | `getDocumentBytes(java.lang.String file, int length)` Retrieve at most 'length' bytes that correspond to the given file name.
    `java.util.Vector<java.lang.String>` | `getDocumentList()` Retrieve a list of all files in the current POI file system.
    `loci.common.RandomAccessInputStream` | `getDocumentStream(java.lang.String file)` Retrieve a RandomAccessInputStream corresponding to the given file name.
    `int` | `getFileSize(java.lang.String file)` Retrieve the total number of bytes in the given file.
    `java.io.InputStream` | `getInputStream(java.lang.String file)` Retrieve an InputStream corresponding to the given file name.
    `void` | `initialize(loci.common.RandomAccessInputStream s)` Construct a new POI filesystem around the given stream.
    `void` | `initialize(java.lang.String file)` Construct a new POI filesystem around the given file.
    `private void` | `parseFile(loci.poi.poifs.filesystem.DirectoryEntry r)`

    - ### Methods inherited from class loci.common.services.AbstractService

      `checkClassDependency`

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

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

- - ### Field Detail

    - #### MAX_BLOCK_SIZE

          private static final int MAX_BLOCK_SIZE

      See Also:
        Constant Field Values

    - #### POI_MAGIC_BYTES

          public static final int POI_MAGIC_BYTES

      See Also:
        Constant Field Values

    - #### fileSystem

          private loci.poi.poifs.filesystem.POIFSFileSystem fileSystem

    - #### root

          private loci.poi.poifs.filesystem.DirectoryEntry root

    - #### stream

          private loci.common.RandomAccessInputStream stream

    - #### filePath

          private java.util.Vector<java.lang.String> filePath

    - #### fileSizes

          private java.util.Hashtable<java.lang.String,java.lang.Integer> fileSizes

    - #### files

          private java.util.Hashtable<java.lang.String,loci.poi.poifs.filesystem.DocumentEntry> files

  - ### Constructor Detail

    - #### POIServiceImpl

          public POIServiceImpl()

      Default constructor.

  - ### Method Detail

    - #### initialize

          public void initialize(java.lang.String file)
                          throws java.io.IOException

      Description copied from interface: `POIService`
      Construct a new POI filesystem around the given file.
      Specified by:
        `initialize` in interface `POIService`
      Throws:
        `java.io.IOException` - if an error occurred when opening the file.

    - #### initialize

          public void initialize(loci.common.RandomAccessInputStream s)
                          throws java.io.IOException

      Description copied from interface: `POIService`
      Construct a new POI filesystem around the given stream.
      Specified by:
        `initialize` in interface `POIService`
      Throws:
        `java.io.IOException` - if an error occurred when reading from the stream.

    - #### getInputStream

          public java.io.InputStream getInputStream(java.lang.String file)
                                             throws java.io.IOException

      Description copied from interface: `POIService`
      Retrieve an InputStream corresponding to the given file name. Either of the 'initialize' methods must be called before this method.
      Specified by:
        `getInputStream` in interface `POIService`
      Parameters:
        `file` - The name of the embedded file for which to retrieve an InputStream.
      Throws:
        `java.io.IOException` - if an error occurred when reading the file

    - #### getDocumentStream

          public loci.common.RandomAccessInputStream getDocumentStream(java.lang.String file)
                                                                throws java.io.IOException

      Description copied from interface: `POIService`
      Retrieve a RandomAccessInputStream corresponding to the given file name. Either of the 'initialize' methods must be called before this method.
      Specified by:
        `getDocumentStream` in interface `POIService`
      Parameters:
        `file` - The name of the embedded file for which to retrieve a RandomAccessInputStream.
      Throws:
        `java.io.IOException` - if an error occurred when reading the file

    - #### getDocumentBytes

          public byte[] getDocumentBytes(java.lang.String file)
                                  throws java.io.IOException

      Description copied from interface: `POIService`
      Retrieve all of the raw bytes that correspond to the given file name. Either of the 'initialize' methods must be called before this method.
      Specified by:
        `getDocumentBytes` in interface `POIService`
      Parameters:
        `file` - The name of the embedded file for which to retrieve bytes.
      Throws:
        `java.io.IOException` - if an error occurred when reading the file

    - #### getDocumentBytes

          public byte[] getDocumentBytes(java.lang.String file,
                                         int length)
                                  throws java.io.IOException

      Description copied from interface: `POIService`
      Retrieve at most 'length' bytes that correspond to the given file name. Either of the 'initialize' methods must be called before this method.
      Specified by:
        `getDocumentBytes` in interface `POIService`
      Parameters:
        `file` - The name of the embedded file for which to retrieve bytes.
      Throws:
        `java.io.IOException` - if an error occurred when reading the file

    - #### getFileSize

          public int getFileSize(java.lang.String file)

      Description copied from interface: `POIService`
      Retrieve the total number of bytes in the given file. Either of the 'initialize' methods must be called before this method.
      Specified by:
        `getFileSize` in interface `POIService`
      Parameters:
        `file` - The name of the embedded file.

    - #### getDocumentList

          public java.util.Vector<java.lang.String> getDocumentList()

      Description copied from interface: `POIService`
      Retrieve a list of all files in the current POI file system.
      Specified by:
        `getDocumentList` in interface `POIService`

    - #### close

          public void close()
                     throws java.io.IOException

      Description copied from interface: `POIService`
      Close the current POI file system.
      Specified by:
        `close` in interface `POIService`
      Throws:
        `java.io.IOException`

    - #### parseFile

          private void parseFile(loci.poi.poifs.filesystem.DirectoryEntry r)
                          throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright © 2026 Open Microscopy Environment