Here you can find the source of getBinaryStream(Object value, int columnType)
public static java.io.InputStream getBinaryStream(Object value, int columnType) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static java.io.InputStream getBinaryStream(Object value, int columnType) throws Exception { InputStream binaryStream = null; // check for NULL if (value == null) { return null; }// w ww . j a v a2 s .co m if ((isBinary(columnType) == false) && (isString(columnType) == false)) { throw new Exception( "binaryStream conversion failed. (" + value.toString().trim() + "/" + columnType + ")"); } binaryStream = new ByteArrayInputStream((byte[]) value); return (java.io.InputStream) binaryStream; } public static boolean isBinary(int dataType) { switch (dataType) { case java.sql.Types.BLOB: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: case java.sql.Types.SQLXML: return true; default: return false; } } public static boolean isString(int dataType) { switch (dataType) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.NVARCHAR: case java.sql.Types.LONGNVARCHAR: return true; default: return false; } } }