"""
Python module generated from Java source file com.google.common.io.FileBackedOutputStream

Java source file obtained from artifact guava version 21.0

Because this Python module is automatically generated, it may contain errors
and/or code that cannot be parsed. Please report these issues at
https://github.com/magicmq/docs-translator/issues
"""
from com.google.common.annotations import Beta
from com.google.common.annotations import GwtIncompatible
from com.google.common.annotations import VisibleForTesting
from com.google.common.io import *
from java.io import ByteArrayInputStream
from java.io import ByteArrayOutputStream
from java.io import File
from java.io import FileInputStream
from java.io import FileOutputStream
from java.io import IOException
from java.io import InputStream
from java.io import OutputStream
from typing import Any, Callable, Iterable, Tuple


class FileBackedOutputStream(OutputStream):
    """
    An OutputStream that starts buffering to a byte array, but switches to file buffering
    once the data reaches a configurable size.
    
    This class is thread-safe.

    Author(s)
    - Chris Nokleberg

    Since
    - 1.0
    """

    def __init__(self, fileThreshold: int):
        """
        Creates a new instance that uses the given file threshold, and does not reset the data when the
        ByteSource returned by .asByteSource is finalized.

        Arguments
        - fileThreshold: the number of bytes before the stream should switch to buffering to a file
        """
        ...


    def __init__(self, fileThreshold: int, resetOnFinalize: bool):
        """
        Creates a new instance that uses the given file threshold, and optionally resets the data when
        the ByteSource returned by .asByteSource is finalized.

        Arguments
        - fileThreshold: the number of bytes before the stream should switch to buffering to a file
        - resetOnFinalize: if True, the .reset method will be called when the
            ByteSource returned by .asByteSource is finalized
        """
        ...


    def asByteSource(self) -> "ByteSource":
        """
        Returns a readable ByteSource view of the data that has been written to this stream.

        Since
        - 15.0
        """
        ...


    def reset(self) -> None:
        """
        Calls .close if not already closed, and then resets this object back to its initial
        state, for reuse. If data was buffered to a file, it will be deleted.

        Raises
        - IOException: if an I/O error occurred while deleting the file buffer
        """
        ...


    def write(self, b: int) -> None:
        ...


    def write(self, b: list[int]) -> None:
        ...


    def write(self, b: list[int], off: int, len: int) -> None:
        ...


    def close(self) -> None:
        ...


    def flush(self) -> None:
        ...
