org.apache.lucene.mockfile

## Class LeakFS

- java.lang.Object
- - java.nio.file.spi.FileSystemProvider
  - - org.apache.lucene.mockfile.FilterFileSystemProvider
    - - org.apache.lucene.mockfile.HandleTrackingFS
      - - org.apache.lucene.mockfile.LeakFS

-     public class LeakFS
      extends HandleTrackingFS

  FileSystem that tracks open handles.

  When `FileSystem.close()` is called, this class will throw an exception if any file handles are still open.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.mockfile.FilterFileSystemProvider

      `delegate, fileSystem, scheme`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LeakFS(FileSystem delegate)` Create a new instance, tracking file handle leaks for the specified delegate filesystem.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onClose()` Override to trigger some behavior when the filesystem is closed.
    `protected void` | `onClose(Path path, Object stream)` Called when `path` is closed via `stream`.
    `protected void` | `onOpen(Path path, Object stream)` Called when `path` is opened via `stream`.

    - ### Methods inherited from class org.apache.lucene.mockfile.HandleTrackingFS

      `newAsynchronousFileChannel, newByteChannel, newDirectoryStream, newFileChannel, newInputStream, newOutputStream`

    - ### Methods inherited from class org.apache.lucene.mockfile.FilterFileSystemProvider

      `checkAccess, copy, createDirectory, createLink, createSymbolicLink, delete, deleteIfExists, getFileAttributeView, getFileStore, getFileSystem, getPath, getScheme, isHidden, isSameFile, move, newFileSystem, newFileSystem, readAttributes, readAttributes, readSymbolicLink, setAttribute, toDelegate, toString`

    - ### Methods inherited from class java.nio.file.spi.FileSystemProvider

      `installedProviders`

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

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

- - ### Constructor Detail

    - #### LeakFS

          public LeakFS(FileSystem delegate)

      Create a new instance, tracking file handle leaks for the specified delegate filesystem.
      Parameters:
        `delegate` - delegate filesystem to wrap.

  - ### Method Detail

    - #### onOpen

          protected void onOpen(Path path,
                                Object stream)

      Description copied from class: `HandleTrackingFS`
      Called when `path` is opened via `stream`.
      Specified by:
        `onOpen` in class `HandleTrackingFS`
      Parameters:
        `path` - Path that was opened
        `stream` - Stream or Channel opened against the path.

    - #### onClose

          protected void onClose(Path path,
                                 Object stream)

      Description copied from class: `HandleTrackingFS`
      Called when `path` is closed via `stream`.
      Specified by:
        `onClose` in class `HandleTrackingFS`
      Parameters:
        `path` - Path that was closed
        `stream` - Stream or Channel closed against the path.

    - #### onClose

          public void onClose()

      Description copied from class: `FilterFileSystemProvider`
      Override to trigger some behavior when the filesystem is closed.

      This is always called for each FilterFileSystemProvider in the chain.

      Overrides:
        `onClose` in class `FilterFileSystemProvider`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.