I’m reading a BLOB from a db column and it ends up in the results output of the query method. The BLOB is contained in a T/String wm type. It appears to be base64 encoded but I’m not sure …
Has anyone successfully taking that String and actually written it to a filesystem in its native format so it can be viewed?
Here is what I tried:
- Took the string and pub.string:base64decoded it into a byte type.
- Sent it to a Java service that executed the following code:
IDataHashCursor pipelineCursor = pipeline.getHashCursor();
pipelineCursor.first( “pathToFile” );
String pathToFile = (String) pipelineCursor.getValue();
pipelineCursor.first( “bytes” );
Object bytes = pipelineCursor.getValue();
try{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(bytes);
byte theObjectBytes = baos.toByteArray();
File f = new File(pathToFile);
FileOutputStream fos = new FileOutputStream(f);
fos.write(theObjectBytes);
fos.close();
}catch (Exception e){
System.out.println(e);
}
but unfortunantly it was mangled. Any thoughts on whats going on?