Created
February 12, 2013 12:20
-
-
Save tomgullo/4761959 to your computer and use it in GitHub Desktop.
get blob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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