本文整理了Java中oracle.sql.BLOB.putBytes()
方法的一些代码示例,展示了BLOB.putBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BLOB.putBytes()
方法的具体详情如下:
包路径:oracle.sql.BLOB
类名称:BLOB
方法名:putBytes
暂无
代码示例来源:origin: quartz-scheduler/quartz
@SuppressWarnings("deprecation")
protected Blob writeDataToBlob(ResultSet rs, int column, byte[] data) throws SQLException {
Blob blob = rs.getBlob(column); // get blob
if (blob == null) {
throw new SQLException("Driver's Blob representation is null!");
}
if (blob instanceof oracle.sql.BLOB) { // is it an oracle blob?
((oracle.sql.BLOB) blob).putBytes(1, data);
((oracle.sql.BLOB) blob).trim(data.length);
return blob;
} else {
throw new SQLException(
"Driver's Blob representation is of an unsupported type: "
+ blob.getClass().getName());
}
}
}
代码示例来源:origin: quartz-scheduler/quartz
@SuppressWarnings("deprecation")
protected Blob writeDataToBlob(ResultSet rs, int column, byte[] data) throws SQLException {
Blob blob = rs.getBlob(column); // get blob
if (blob == null) {
throw new SQLException("Driver's Blob representation is null!");
}
if (blob instanceof oracle.sql.BLOB) { // is it an oracle blob?
((oracle.sql.BLOB) blob).putBytes(1, data);
((oracle.sql.BLOB) blob).trim(data.length);
return blob;
} else {
throw new SQLException(
"Driver's Blob representation is of an unsupported type: "
+ blob.getClass().getName());
}
}
}
代码示例来源:origin: stackoverflow.com
rset.next();
Blob bobj = rset.getBlob(1);
BLOB object = (BLOB) bobj;
int chunkSize = object.getChunkSize();
byte[] binaryBuffer = new byte[chunkSize];
int position = 1;
int bytesRead = 0;
int bytesWritten = 0, totbytesRead = 0, totbytesWritten = 0;
InputStream is = fileItem.getInputStream();
while ((bytesRead = is.read(binaryBuffer)) != -1) {
bytesWritten = object.putBytes(position, binaryBuffer, bytesRead);
position += bytesRead;
totbytesRead += bytesRead;
totbytesWritten += bytesWritten;
is.close();
代码示例来源:origin: org.quartz-scheduler/quartz-oracle
@SuppressWarnings("deprecation")
protected Blob writeDataToBlob(ResultSet rs, int column, byte[] data) throws SQLException {
Blob blob = rs.getBlob(column); // get blob
if (blob == null) {
throw new SQLException("Driver's Blob representation is null!");
}
if (blob instanceof oracle.sql.BLOB) { // is it an oracle blob?
((oracle.sql.BLOB) blob).putBytes(1, data);
((oracle.sql.BLOB) blob).trim(data.length);
return blob;
} else {
throw new SQLException(
"Driver's Blob representation is of an unsupported type: "
+ blob.getClass().getName());
}
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Write LOB value - only on Oracle8 and up
*/
@SuppressWarnings("deprecation")
public void writeLOB(DatabaseField field, Object value, ResultSet resultSet, AbstractSession session) throws SQLException {
if (isBlob(field.getType())) {
//change for 338585 to use getName instead of getNameDelimited
oracle.sql.BLOB blob = (oracle.sql.BLOB)resultSet.getObject(field.getName());
//we could use the jdk 1.4 java.nio package and use channel/buffer for the writing
//for the time being, simply use Oracle api.
blob.putBytes(1, (byte[])value);
//impose the locallization
session.log(SessionLog.FINEST, SessionLog.SQL, "write_BLOB", Long.valueOf(blob.length()), field.getName());
} else if (isClob(field.getType())) {
//change for 338585 to use getName instead of getNameDelimited
oracle.sql.CLOB clob = (oracle.sql.CLOB)resultSet.getObject(field.getName());
//we could use the jdk 1.4 java.nio package and use channel/buffer for the writing
//for the time being, simply use Oracle api.
clob.putString(1, (String)value);
//impose the locallization
session.log(SessionLog.FINEST, SessionLog.SQL, "write_CLOB", Long.valueOf(clob.length()), field.getName());
} else {
//do nothing for now, open to BFILE or NCLOB types
}
}
代码示例来源:origin: jpox/jpox
if (blob != null)
blob.putBytes(1, bytes);
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
blob.putBytes(1, bytes); // Deprecated but what can you do
内容来源于网络,如有侵权,请联系作者删除!