public void moveSQLToField ( ResultSet resultset , int iColumn ) throws SQLException { InputStream inStream = resultset . getBinaryStream ( iColumn ) ; if ( resultset . wasNull ( ) ) this . setData ( null , false , DBConstants . READ_MOVE ) ; // Null value else { try { // This is kind of weird, but for some reason, the inStream will only accept read(byte[]), so I have to do this: byte rgBytes [ ] = new byte [ 2048 ] ; ByteArrayOutputStream baOut = new ByteArrayOutputStream ( ) ; while ( true ) { int iRead = 0 ; try { iRead = inStream . read ( rgBytes ) ; } catch ( EOFException ex ) { iRead = 0 ; } if ( iRead > 0 ) baOut . write ( rgBytes , 0 , iRead ) ; if ( iRead < rgBytes . length ) break ; // End of stream } rgBytes = baOut . toByteArray ( ) ; Object objData = null ; if ( rgBytes . length > 0 ) { String string = new String ( rgBytes , BundleConstants . OBJECT_ENCODING ) ; objData = ClassServiceUtility . getClassService ( ) . convertStringToObject ( string , null ) ; //x ByteArrayInputStream ibyStream = new ByteArrayInputStream(rgBytes); //x ObjectInputStream iStream = new ObjectInputStream(ibyStream); //x objData = iStream.readObject(); } this . setData ( objData , false , DBConstants . READ_MOVE ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; // Never } catch ( ClassNotFoundException ex ) { ex . printStackTrace ( ) ; // Never } } }
Move the physical binary data to this SQL parameter row . This method uses the getBinaryStream resultset method .