# Session

Package

## Interface Session

-     public interface Session

  Common interface for all `FFmpegKit` sessions.

- - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract LogCallback` | `getLogCallback()` | Returns the session specific log callback.
    `abstract long` | `getSessionId()` | Returns the session identifier.
    `abstract Date` | `getCreateTime()` | Returns session create time.
    `abstract Date` | `getStartTime()` | Returns session start time.
    `abstract Date` | `getEndTime()` | Returns session end time.
    `abstract long` | `getDuration()` | Returns the time taken to execute this session.
    `abstract Array<String>` | `getArguments()` | Returns command arguments as an array.
    `abstract String` | `getCommand()` | Returns command arguments as a concatenated string.
    `abstract List<Log>` | `getAllLogs(int waitTimeout)` | Returns all log entries generated for this session.
    `abstract List<Log>` | `getAllLogs()` | Returns all log entries generated for this session.
    `abstract List<Log>` | `getLogs()` | Returns all log entries delivered for this session.
    `abstract String` | `getAllLogsAsString(int waitTimeout)` | Returns all log entries generated for this session as a concatenated string.
    `abstract String` | `getAllLogsAsString()` | Returns all log entries generated for this session as a concatenated string.
    `abstract String` | `getLogsAsString()` | Returns all log entries delivered for this session as a concatenated string.
    `abstract String` | `getOutput()` | Returns the log output generated while running the session.
    `abstract SessionState` | `getState()` | Returns the state of the session.
    `abstract ReturnCode` | `getReturnCode()` | Returns the return code for this session.
    `abstract String` | `getFailStackTrace()` | Returns the stack trace of the exception received while executing this session.
    `abstract LogRedirectionStrategy` | `getLogRedirectionStrategy()` | Returns session specific log redirection strategy.
    `abstract boolean` | `thereAreAsynchronousMessagesInTransmit()` | Returns whether there are still asynchronous messages being transmitted for thissession or not.
    `abstract void` | `addLog(Log log)` | Adds a new log entry for this session.
    `abstract Future<out Object>` | `getFuture()` | Returns the future created for this session, if it is executed asynchronously.
    `abstract boolean` | `isFFmpeg()` | Returns whether it is an `FFmpeg` session or not.
    `abstract boolean` | `isFFprobe()` | Returns whether it is an `FFprobe` session or not.
    `abstract boolean` | `isMediaInformation()` | Returns whether it is a `MediaInformation` session or not.
    `abstract void` | `cancel()` | Cancels running the session.

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

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

- - ### Method Detail

    - #### getLogCallback

           abstract LogCallback getLogCallback()

      Returns the session specific log callback.

    - #### getSessionId

           abstract long getSessionId()

      Returns the session identifier.

    - #### getCreateTime

           abstract Date getCreateTime()

      Returns session create time.

    - #### getStartTime

           abstract Date getStartTime()

      Returns session start time.

    - #### getEndTime

           abstract Date getEndTime()

      Returns session end time.

    - #### getDuration

           abstract long getDuration()

      Returns the time taken to execute this session.

    - #### getArguments

           abstract Array<String> getArguments()

      Returns command arguments as an array.

    - #### getCommand

           abstract String getCommand()

      Returns command arguments as a concatenated string.

    - #### getAllLogs

           abstract List<Log> getAllLogs(int waitTimeout)

      Returns all log entries generated for this session. If there are asynchronousmessages that are not delivered yet, this method waits for them until the given timeout.

      Parameters:
        `waitTimeout` - wait timeout for asynchronous messages in milliseconds

    - #### getAllLogs

           abstract List<Log> getAllLogs()

      Returns all log entries generated for this session. If there are asynchronousmessages that are not delivered yet, this method waits for them.

    - #### getLogs

           abstract List<Log> getLogs()

      Returns all log entries delivered for this session. Note that if there are asynchronous logmessages that are not delivered yet, this method will not wait for them and will returnimmediately.

    - #### getAllLogsAsString

           abstract String getAllLogsAsString(int waitTimeout)

      Returns all log entries generated for this session as a concatenated string. If there areasynchronous messages that are not delivered yet, this method waits for them untilthe given timeout.

      Parameters:
        `waitTimeout` - wait timeout for asynchronous messages in milliseconds

    - #### getAllLogsAsString

           abstract String getAllLogsAsString()

      Returns all log entries generated for this session as a concatenated string. If there areasynchronous messages that are not delivered yet, this method waits for them.

    - #### getLogsAsString

           abstract String getLogsAsString()

      Returns all log entries delivered for this session as a concatenated string. Note that ifthere are asynchronous log messages that are not delivered yet, this method will not waitfor them and will return immediately.

    - #### getOutput

           abstract String getOutput()

      Returns the log output generated while running the session.

    - #### getState

           abstract SessionState getState()

      Returns the state of the session.

    - #### getReturnCode

           abstract ReturnCode getReturnCode()

      Returns the return code for this session. Note that return code is only set for sessionsthat end with COMPLETED state. If a session is not started, still running or failed thenthis method returns null.

    - #### getFailStackTrace

           abstract String getFailStackTrace()

      Returns the stack trace of the exception received while executing this session.

      The stack trace is only set for sessions that end with FAILED state. For sessions that hasCOMPLETED state this method returns null.

    - #### getLogRedirectionStrategy

           abstract LogRedirectionStrategy getLogRedirectionStrategy()

      Returns session specific log redirection strategy.

    - #### thereAreAsynchronousMessagesInTransmit

           abstract boolean thereAreAsynchronousMessagesInTransmit()

      Returns whether there are still asynchronous messages being transmitted for thissession or not.

    - #### addLog

           abstract void addLog(Log log)

      Adds a new log entry for this session.

      It is invoked internally by `FFmpegKit` library methods. Must not be used by userapplications.

      Parameters:
        `log` - log entry

    - #### getFuture

           abstract Future<out Object> getFuture()

      Returns the future created for this session, if it is executed asynchronously.

    - #### isFFmpeg

           abstract boolean isFFmpeg()

      Returns whether it is an `FFmpeg` session or not.

    - #### isFFprobe

           abstract boolean isFFprobe()

      Returns whether it is an `FFprobe` session or not.

    - #### isMediaInformation

           abstract boolean isMediaInformation()

      Returns whether it is a `MediaInformation` session or not.

    - #### cancel

           abstract void cancel()

      Cancels running the session.