當前位置: 首頁>>代碼示例>>Java>>正文


Java Blob.free方法代碼示例

本文整理匯總了Java中java.sql.Blob.free方法的典型用法代碼示例。如果您正苦於以下問題:Java Blob.free方法的具體用法?Java Blob.free怎麽用?Java Blob.free使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.sql.Blob的用法示例。


在下文中一共展示了Blob.free方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: close

import java.sql.Blob; //導入方法依賴的package包/類
@Override
public void close() {
	try {
		for (Blob blob : this.temporaryBlobs) {
			blob.free();
		}
		for (Clob clob : this.temporaryClobs) {
			clob.free();
		}
	}
	catch (SQLException ex) {
		logger.error("Could not free LOB", ex);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:TemporaryLobCreator.java

示例2: getObjectFromBlob

import java.sql.Blob; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * <p>
 * Caché requires {@code java.sql.Blob} instances to be explicitly freed.
 */
@Override
protected Object getObjectFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException {
    Blob blob = rs.getBlob(colName);
    if (blob == null) {
        return null;
    } else {
        try {
            if (blob.length() == 0) {
                return null;
            } else {
                InputStream binaryInput = blob.getBinaryStream();
                if (binaryInput == null) {
                    return null;
                } else if (binaryInput instanceof ByteArrayInputStream && ((ByteArrayInputStream) binaryInput).available() == 0 ) {
                    return null;
                } else {
                    ObjectInputStream in = new ObjectInputStream(binaryInput);
                    try {
                        return in.readObject();
                    } finally {
                        in.close();
                    }
                }
            }
        } finally {
            blob.free();
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:35,代碼來源:CacheDelegate.java

示例3: toEvent

import java.sql.Blob; //導入方法依賴的package包/類
private Event toEvent ( final ResultSet resultSet ) throws SQLException, IOException, ClassNotFoundException
{
    byte[] data;
    switch ( this.jdbcDao.dataFormat )
    {
        case JSON:
            return EventConverter.INSTANCE.toEvent ( resultSet.getString ( 4 ) );
        case BLOB:
            final Blob blob = resultSet.getBlob ( 4 );
            data = blob.getBytes ( 0, Long.valueOf ( blob.length () ).intValue () );
            blob.free ();
            break;
        case BYTES:
            //$FALL-THROUGH$
        default:
            data = resultSet.getBytes ( 4 );
            break;
    }

    logger.trace ( "Deserialize event" );

    final BundleObjectInputStream stream = new BundleObjectInputStream ( new ByteArrayInputStream ( data ), Activator.getContext ().getBundle () );
    try
    {
        final Object o = stream.readObject ();
        if ( o instanceof Event )
        {
            return (Event)o;
        }
        else if ( o == null )
        {
            logger.warn ( "Found null event" );
            return null;
        }
        else
        {
            logger.warn ( "Expected event type {} but found {}. Discarding...", Event.class, o.getClass () );
            return null;
        }
    }
    finally
    {
        stream.close ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:46,代碼來源:EventInjector.java


注:本文中的java.sql.Blob.free方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。