Package Torello.Java

Class OSJavaPipe

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class OSJavaPipe
    extends java.lang.Object
    implements java.lang.Cloneable
    Allows a user to pipe data directly from Java-Memory, and into an instance of java.lang.Process.


    • Field Detail

      • INT_ARR

        🡇     🗕  🗗  🗖
        public static final byte INT_ARR
        Constant used to indicate that this class data-contents currently contain a non-null int[]-Array.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte INT_ARR = 1;
        
      • BYTE_ARR

        🡅  🡇     🗕  🗗  🗖
        public static final byte BYTE_ARR
        Constant used to indicate that this class data-contents currently contain a non-null byte[]-Array.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte BYTE_ARR = 2;
        
      • CHAR_ARR

        🡅  🡇     🗕  🗗  🗖
        public static final byte CHAR_ARR
        Constant used to indicate that this class data-contents currently contain a non-null char[]-Array.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte CHAR_ARR = 3;
        
      • STRING

        🡅  🡇     🗕  🗗  🗖
        public static final byte STRING
        Constant used to indicate that this class data-contents currently contain a non-null String.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte STRING = 4;
        
      • INPUT_STREAM

        🡅  🡇     🗕  🗗  🗖
        public static final byte INPUT_STREAM
        Constant used to indicate that this class data-contents currently contain a non-null InputStream.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final byte INPUT_STREAM = 5;
        
    • Constructor Detail

      • OSJavaPipe

        🡅  🡇     🗕  🗗  🗖
        public OSJavaPipe​(int[] intArrData)
        Constructs an instance of this class, assigning the input int[]-Array Parameter to the internal Data-Field.
        Parameters:
        intArrData - Any Java int[] Integer-Array.
        Throws:
        java.lang.NullPointerException - if 'intArrData' is null.
      • OSJavaPipe

        🡅  🡇     🗕  🗗  🗖
        public OSJavaPipe​(byte[] byteArrData)
        Constructs an instance of this class, assigning the input byte[]-Array Parameter to the internal Data-Field.
        Parameters:
        byteArrData - Any Java byte[] Byte-Array.
        Throws:
        java.lang.NullPointerException - if 'byteArrData' is null.
      • OSJavaPipe

        🡅  🡇     🗕  🗗  🗖
        public OSJavaPipe​(char[] charArrData)
        Constructs an instance of this class, assigning the input char[]-Array Parameter to the internal Data-Field.
        Parameters:
        charArrData - Any Java char[] Char-Array.
        Throws:
        java.lang.NullPointerException - if 'charArrData' is null.
      • OSJavaPipe

        🡅  🡇     🗕  🗗  🗖
        public OSJavaPipe​(java.lang.String strData)
        Constructs an instance of this class, assigning the input String-Parameter to the internal Data-Field.
        Parameters:
        strData - Any Java String.
        Throws:
        java.lang.NullPointerException - if 'strData' is null.
      • OSJavaPipe

        🡅  🡇     🗕  🗗  🗖
        public OSJavaPipe​(java.io.InputStream inputStream)
        Constructs an instance of this class, assigning the InputStream Parameter to the internal Data-Field.
        Parameters:
        inputStream - Any Java Input-Stream.
        Throws:
        java.lang.NullPointerException - if 'inputStream' is null.
    • Method Detail

      • getDataType

        🡅  🡇     🗕  🗗  🗖
        public byte getDataType()
        Retrieve the Data-Type that is contained by this instance' internal PIPE-Data contents.
        Returns:
        The Static-Flag Constant associated with the Data-Type that has been assigned to this instance.
        Code:
        Exact Method Body:
         return this.dataType;
        
      • getPipeData

        🡅  🡇     🗕  🗗  🗖
        public java.lang.Object getPipeData()
        Retrieve the actual data, as a java.lang.Object contained by this instance.
        Returns:
        This class internal Data-Field
        Code:
        Exact Method Body:
         return this.textOrDataToPipe;
        
      • setData

        🡅  🡇     🗕  🗗  🗖
        public void setData​(int[] intArrData)
        Sets the data to be used for piping into an Operating-System Process.
        Parameters:
        intArrData - Any Java int[] Integer-Array.
        Throws:
        java.lang.NullPointerException - if 'intArrData' is null.
        Code:
        Exact Method Body:
         Objects.requireNonNull(intArrData, "The int[]-Array passed may not be null");
        
         this.textOrDataToPipe   = intArrData;
         this.dataType           = INT_ARR;
        
      • setData

        🡅  🡇     🗕  🗗  🗖
        public void setData​(byte[] byteArrData)
        Sets the data to be used for piping into an Operating-System Process.
        Parameters:
        byteArrData - Any Java byte[] Byte-Array.
        Throws:
        java.lang.NullPointerException - if 'byteArrData' is null.
        Code:
        Exact Method Body:
         Objects.requireNonNull(byteArrData, "The byte[]-Array passed may not be null");
        
         this.textOrDataToPipe   = byteArrData;
         this.dataType           = BYTE_ARR;
        
      • setData

        🡅  🡇     🗕  🗗  🗖
        public void setData​(char[] charArrData)
        Sets the data to be used for piping into an Operating-System Process.
        Parameters:
        charArrData - Any Java char[] Char-Array.
        Throws:
        java.lang.NullPointerException - if 'charArrData' is null.
        Code:
        Exact Method Body:
         Objects.requireNonNull(charArrData, "The char[]-Array passed may not be null");
        
         this.textOrDataToPipe   = charArrData;
         this.dataType           = CHAR_ARR;
        
      • setData

        🡅  🡇     🗕  🗗  🗖
        public void setData​(java.lang.String strData)
        Sets the data to be used for piping into an Operating-System Process.
        Parameters:
        strData - Any Java String.
        Throws:
        java.lang.NullPointerException - if 'strData' is null.
        Code:
        Exact Method Body:
         Objects.requireNonNull(strData, "The String-Data passed may not be null");
        
         this.textOrDataToPipe   = strData;
         this.dataType           = STRING;
        
      • setData

        🡅  🡇     🗕  🗗  🗖
        public void setData​(java.io.InputStream inputStream)
        Sets the data to be used for piping into an Operating-System Process.
        Parameters:
        inputStream - Any Java Input-Stream.
        Throws:
        java.lang.NullPointerException - if 'inputStream' is null.
        Code:
        Exact Method Body:
         Objects.requireNonNull(inputStream, "The Input-Stream passed may not be null");
        
         this.textOrDataToPipe   = inputStream;
         this.dataType           = INPUT_STREAM;
        
      • toString

        🡅  🡇     🗕  🗗  🗖
        public java.lang.String toString()
        Generates a String this class. The returned String merely converts the contained data to a String, using Standard Java Methods.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A simple representation of this class, as a java.lang.String
        Code:
        Exact Method Body:
         switch (this.dataType)
         {
             case INT_ARR : return NAME + "int[]:\n" + StrPrint.abbrev(
                 Arrays.toString((int[]) this.textOrDataToPipe),
                 60, true, null, 120
             );
        
             case BYTE_ARR : return NAME + "byte[]:\n" + StrPrint.abbrev(
                 Arrays.toString((byte[]) this.textOrDataToPipe),
                 60, true, null, 120
             );
        
             case CHAR_ARR : return NAME + "char[]:\n" + StrPrint.abbrev(
                 Arrays.toString((char[]) this.textOrDataToPipe),
                 60, true, null, 120
             );
        
             case STRING : return NAME + "String:\n" + StrPrint.abbrev
                 ((String) this.textOrDataToPipe, 60, true, null, 120);
        
             case INPUT_STREAM : return NAME + "InputStream: Non-Null Data-Input\n";
        
             default: throw new UnreachableError();
         }
        
      • equals

        🡅  🡇     🗕  🗗  🗖
        public boolean equals​(java.lang.Object other)
        Checks for equality based on whether two instances have identical references.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - Any Java Object. Only a valid sub-class of OSJavaPipe could possibly produce a TRUE return value
        Returns:
        TRUE if and only if this class' internal fields are identical references in both 'this' and 'other'.
        Code:
        Exact Method Body:
         if (other == null)                      return false;
         if (! (other instanceof OSJavaPipe))    return false;
        
         final OSJavaPipe o = (OSJavaPipe) other;
        
         return
                 Objects.equals(this.textOrDataToPipe, o.textOrDataToPipe)
             &&  (this.dataType == o.dataType);
        
      • clone

        🡅  🡇     🗕  🗗  🗖
        public java.lang.Object clone()
        Makes a copy of 'this' instance and returns it.
        Overrides:
        clone in class java.lang.Object
        Returns:
        a clone of 'this' instance
        Code:
        Exact Method Body:
         // Private-Internal Zero-Argument Constructor
         OSJavaPipe ret = new OSJavaPipe(); 
        
         ret.dataType            = this.dataType;
         ret.textOrDataToPipe    = this.textOrDataToPipe;
        
         return ret;
        
      • hashCode

        🡅     🗕  🗗  🗖
        public int hashCode()
        Produces a Hash-Code that may be used to place this instance-reference into a Hash-Table, Set or Map. The code produced is generated using whatever hash-code value is returned by this class' internal textOrDataToPipe hash-code method.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hashcode
        Code:
        Exact Method Body:
         return this.textOrDataToPipe.hashCode();