Class InputWriter

  • All Implemented Interfaces:
    java.lang.Runnable

    public final class InputWriter
    extends java.lang.Thread
    A simple input writer that uses a daemon thread to write from an String to an OutputStream. Once the end of the string is reached, the destination stream will be closed.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      InputWriter​(java.lang.String content, java.io.OutputStream destination)
      Create a new InputWriter that writes content to the destination.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isFinished()
      Poll if the InputWriter has finished writing.
      void run()
      Entry point for the Daemon thread.
      void waitUntilFinished()
      Wait until the InputWriter has finished writing.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • InputWriter

        public InputWriter​(java.lang.String content,
                           java.io.OutputStream destination)
        Create a new InputWriter that writes content to the destination.
        Parameters:
        content - the data to write to the destination.
        destination - the destination to write to.
    • Method Detail

      • isFinished

        public boolean isFinished()
        Poll if the InputWriter has finished writing.
        Returns:
        if the InputWriter has finished writing.
      • waitUntilFinished

        public void waitUntilFinished()
        Wait until the InputWriter has finished writing.
      • run

        public void run()
        Entry point for the Daemon thread.
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread