Topic
2 replies Latest Post - ‏2013-09-06T14:57:16Z by DanDebrunner
Brian Williams
Brian Williams
1 Post
ACCEPTED ANSWER

Pinned topic Request: Sample Java Operator that returns a byte[] as a SPL Blob

‏2013-09-04T14:30:45Z |

I am writing a Java primitive operator and have a byte array (byte[]) returned from a java class.  I want to allow this to be passed back to SPL as an spl blob data type.  Does anyone have an example of how to do this? 

 

Thanks,

Brian
 

  • Stan
    Stan
    76 Posts
    ACCEPTED ANSWER

    Re: Request: Sample Java Operator that returns a byte[] as a SPL Blob

    ‏2013-09-05T19:44:03Z  in response to Brian Williams

    There currently is n mechanism to create a blob attribute value in tuple submitted from a Java primitive operator.  This should be fixed in our next release.

     

     

  • DanDebrunner
    DanDebrunner
    6 Posts
    ACCEPTED ANSWER

    Re: Request: Sample Java Operator that returns a byte[] as a SPL Blob

    ‏2013-09-06T14:57:16Z  in response to Brian Williams

    A work around is to use an rstring attribute to represent the bytes. Rstring is technically a sequence of bytes, so as long as you don't try any string like functions or operations on the attribute, it would be ok.

    You can create a Java com.ibm.streams.operator.types.Rstring object directly from a byte[] and then use OutputTuple.setObject() to set it as the rstring attribute.

    Not sure if you can then use SPL to convert the rstring to a blob for use further down in the graph.