Skip to content

Instantly share code, notes, and snippets.

@tomgullo
Created February 12, 2013 12:20
Show Gist options
  • Save tomgullo/4761959 to your computer and use it in GitHub Desktop.
Save tomgullo/4761959 to your computer and use it in GitHub Desktop.
get blob
//try
def blobFile = new File(fileName)
def outStream = new FileOutputStream(blobFile)
def blob = (oracle.sql.BLOB) result[0]
def inStream = blob.getBinaryStream()
int length = -1
int size = blob.getBufferSize()
byte[] buffer = new byte[size]
while ( ( length = inStream.read(buffer) ) != -1 ) {
outStream.write(buffer, 0, length)
outStream.flush()
}
inStream.close()
outStream.close()
//catch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment