package com.ca.chorus; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.sql.Blob; import java.sql.SQLException; public class UploadUDF { /** * Copies the given input file. * @param input * @return success * @throws IOException * @throws FileNotFoundException * @throws SQLException */ public static Boolean upload(Blob input) throws FileNotFoundException, IOException, SQLException { System.out.println("upload has been called :"+input); if (input == null) { return false; } else{ InputStream ist = input.getBinaryStream(); File f = new File("C:\\abc.cfar"); f.createNewFile(); FileOutputStream fos = new FileOutputStream(f); byte[] buffer = new byte[4096]; int bytesRead = 0; while ((bytesRead = ist.read(buffer)) != -1) { fos.write(buffer, 0, bytesRead); } System.out.println("inside else :"+input.getClass()); } return true; } }