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 anBlob
value from an array of bytes.static Blob
newBlob(byte[] data, int offest, int length)
Create anBlob
value from an array of bytes.static Blob
newBlob(java.nio.ByteBuffer bytes, int length)
Create anBlob
value from a byte stream contained in aByteBuffer
.static Blob
newBlob(RString value)
static org.apache.commons.math.complex.Complex
newComplex32(java.lang.CharSequence value)
Create a Complex representing acomplex32
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 acomplex64
from its SPL character encoding format of(real, imaginary)
.static XML
newXML(java.nio.ByteBuffer bytes, int length)
Create anXML
document value from a byte stream contained in aByteBuffer
.static XML
newXML(java.io.InputStream input)
Create anXML
document value from a byte stream.static XML
newXML(javax.xml.transform.Transformer transformer, javax.xml.transform.Source source)
Create anXML
document value from an XML source input.static Blob
readBlob(java.io.InputStream input)
Read aBlob
value from anInputStream
.static Blob
readBlob(java.io.InputStream input, long length)
Read aBlob
value from anInputStream
.static Blob
readBlobWithPrefixLength(java.io.InputStream input)
Read aBlob
value from anInputStream
where the number of bytes in theBlob
is represented as a four byte length value in the stream before the value.
-
-
-
Field Detail
-
IBM_COPYRIGHT
public static final java.lang.String IBM_COPYRIGHT
- See Also:
- Constant Field Values
-
-
Method Detail
-
newXML
public static XML newXML(java.io.InputStream input) throws java.io.IOException
Create anXML
document value from a byte stream. The resultingXML
is a faithful representation of the bytes in the byte stream as no XML processing or normalization is performed. TheInputStream 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 anXML
document value from a byte stream contained in aByteBuffer
. The resultingXML
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 anXML
document value from an XML source input. The resulting value corresponds tosource
as transformed according to the state oftransformer
.- 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 anBlob
value from a byte stream contained in aByteBuffer
.- Parameters:
bytes
-ByteBuffer
containing bytes for theblob
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)
- Parameters:
value
- Value to be converted to aBlob
.- Returns:
- Converted value.
- Since:
- InfoSphere® Streams Version 4.0
-
newBlob
public static Blob newBlob(byte[] data, int offest, int length)
Create anBlob
value from an array of bytes.- Parameters:
data
- Data to be copied from.offest
- Offset intodata
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 anBlob
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 aBlob
value from anInputStream
. The input stream is completely read.- Parameters:
input
- Input stream to readBlob
value from.- Returns:
Blob
containing the contents ofinput
.- 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
- Parameters:
input
- Input stream to readBlob
value from.length
- Number of bytes to read frominput
.- Returns:
Blob
containing the contents ofinput
withlength
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 aBlob
value from anInputStream
where the number of bytes in theBlob
is represented as a four byte length value in the stream before the value. The length is read using in network byte order, usingjava.io.DataInput.readInt()
.- Parameters:
input
- Input stream to readBlob
value from.- Returns:
Blob
containing the contents ofinput
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 acomplex64
from its SPL character encoding format of(real, imaginary)
. Space characters (\x20) surrounding thereal
andimaginary
values are ignored.- Parameters:
value
- SPL character encodedcomplex64
.- 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 acomplex32
from its SPL character encoding format of(real, imaginary)
. Space characters (\x20) surrounding thereal
andimaginary
values are ignored.- Parameters:
value
- SPL character encodedcomplex32
.- Returns:
- Complex number
- Since:
- InfoSphere® Streams Version 4.0
-
-