com.ibm.streams.operator.types

Class ValueFactory

  • java.lang.Object
    • com.ibm.streams.operator.types.ValueFactory


  • public class ValueFactory
    extends java.lang.Object
    Factory for creating instances of Streams specific attribute value objects.
    Since:
    InfoSphere® Streams Version 3.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String IBM_COPYRIGHT 
    • Constructor Summary

      Constructors 
      Constructor and Description
      ValueFactory() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static Blob newBlob(byte[] data)
      Create an Blob value from an array of bytes.
      static Blob newBlob(byte[] data, int offest, int length)
      Create an Blob value from an array of bytes.
      static Blob newBlob(java.nio.ByteBuffer bytes, int length)
      Create an Blob value from a byte stream contained in a ByteBuffer.
      static Blob newBlob(RString value)
      Create a new Blob with the raw byte contents of an RString.
      static org.apache.commons.math.complex.Complex newComplex32(java.lang.CharSequence value)
      Create a Complex representing a complex32 from its SPL character encoding format of (real, imaginary).
      static org.apache.commons.math.complex.Complex newComplex64(java.lang.CharSequence value)
      Create a Complex representing a complex64 from its SPL character encoding format of (real, imaginary).
      static XML newXML(java.nio.ByteBuffer bytes, int length)
      Create an XML document value from a byte stream contained in a ByteBuffer.
      static XML newXML(java.io.InputStream input)
      Create an XML document value from a byte stream.
      static XML newXML(javax.xml.transform.Transformer transformer, javax.xml.transform.Source source)
      Create an XML document value from an XML source input.
      static Blob readBlob(java.io.InputStream input)
      Read a Blob value from an InputStream.
      static Blob readBlob(java.io.InputStream input, long length)
      Read a Blob value from an InputStream.
      static Blob readBlobWithPrefixLength(java.io.InputStream input)
      Read a Blob value from an InputStream where the number of bytes in the Blob is represented as a four byte length value in the stream before the value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValueFactory

        public ValueFactory()
    • Method Detail

      • newXML

        public static XML newXML(java.io.InputStream input)
                          throws java.io.IOException
        Create an XML document value from a byte stream. The resulting XML is a faithful representation of the bytes in the byte stream as no XML processing or normalization is performed. The InputStream input will be read until the end of file marker but the stream will not be closed.
        Parameters:
        input - Document as a byte stream.
        Returns:
        Document as a XML.
        Throws:
        java.io.IOException - Exception reading stream.
      • newXML

        public static XML newXML(java.nio.ByteBuffer bytes,
                                 int length)
        Create an XML document value from a byte stream contained in a ByteBuffer. The resulting XML is a faithful representation of the bytes in the byte stream as no XML processing or normalization is performed.
        Parameters:
        bytes - ByteBuffer containing document as a byte stream.
        length - number of bytes to extract.
        Returns:
        Document as a XML.
      • newXML

        public static XML newXML(javax.xml.transform.Transformer transformer,
                                 javax.xml.transform.Source source)
                          throws javax.xml.transform.TransformerException
        Create an XML document value from an XML source input. The resulting value corresponds to source as transformed according to the state of transformer.
        Parameters:
        transformer - Transformer to use.
        source - XML source input.
        Returns:
        Document as a XML.
        Throws:
        javax.xml.transform.TransformerException
      • newBlob

        public static Blob newBlob(java.nio.ByteBuffer bytes,
                                   int length)
        Create an Blob value from a byte stream contained in a ByteBuffer.
        Parameters:
        bytes - ByteBuffer containing bytes for the blob value.
        length - number of bytes to extract.
        Returns:
        Value as a Blob.
        Since:
        InfoSphere® Streams Version 3.2
      • newBlob

        public static Blob newBlob(RString value)
        Create a new Blob with the raw byte contents of an RString.
        Parameters:
        value - Value to be converted to a Blob.
        Returns:
        Converted value.
        Since:
        InfoSphere® Streams Version 4.0
      • newBlob

        public static Blob newBlob(byte[] data,
                                   int offest,
                                   int length)
        Create an Blob value from an array of bytes.
        Parameters:
        data - Data to be copied from.
        offest - Offset into data to start copying.
        length - Length to copy.
        Returns:
        Value as a Blob.
        Since:
        InfoSphere® Streams Version 3.2
      • newBlob

        public static Blob newBlob(byte[] data)
        Create an Blob value from an array of bytes.
        Parameters:
        data - Data to be copied from.
        Returns:
        Value as a Blob.
        Since:
        InfoSphere® Streams Version 3.2
      • readBlob

        public static Blob readBlob(java.io.InputStream input)
                             throws java.io.IOException
        Read a Blob value from an InputStream. The input stream is completely read.
        Parameters:
        input - Input stream to read Blob value from.
        Returns:
        Blob containing the contents of input.
        Throws:
        java.io.IOException - Exception reading from the stream.
        Since:
        InfoSphere® Streams Version 3.2
      • readBlob

        public static Blob readBlob(java.io.InputStream input,
                                    long length)
                             throws java.io.IOException
        Read a Blob value from an InputStream. The input stream must contain length bytes.
        Parameters:
        input - Input stream to read Blob value from.
        length - Number of bytes to read from input.
        Returns:
        Blob containing the contents of input with length number of bytes.
        Throws:
        java.io.IOException - Exception reading from the stream.
        Since:
        InfoSphere® Streams Version 3.2
      • readBlobWithPrefixLength

        public static Blob readBlobWithPrefixLength(java.io.InputStream input)
                                             throws java.io.IOException
        Read a Blob value from an InputStream where the number of bytes in the Blob is represented as a four byte length value in the stream before the value. The length is read using in network byte order, using java.io.DataInput.readInt().
        Parameters:
        input - Input stream to read Blob value from.
        Returns:
        Blob containing the contents of input with number of bytes determined from the first four bytes of the stream.
        Throws:
        java.io.IOException - Exception reading from the stream.
        Since:
        InfoSphere® Streams Version 3.2
      • newComplex64

        public static org.apache.commons.math.complex.Complex newComplex64(java.lang.CharSequence value)
        Create a Complex representing a complex64 from its SPL character encoding format of (real, imaginary). Space characters (\x20) surrounding the real and imaginary values are ignored.
        Parameters:
        value - SPL character encoded complex64.
        Returns:
        Complex number
        Since:
        InfoSphere® Streams Version 4.0
      • newComplex32

        public static org.apache.commons.math.complex.Complex newComplex32(java.lang.CharSequence value)
        Create a Complex representing a complex32 from its SPL character encoding format of (real, imaginary). Space characters (\x20) surrounding the real and imaginary values are ignored.
        Parameters:
        value - SPL character encoded complex32.
        Returns:
        Complex number
        Since:
        InfoSphere® Streams Version 4.0