下面列出了java.sql.PreparedStatement#setUnicodeStream ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings("deprecation")
@Test
public void assertSetUnicodeStream() throws SQLException, IOException {
for (PreparedStatement each : preparedStatements) {
try (InputStream inputStream = new ByteArrayInputStream(new byte[]{})) {
each.setUnicodeStream(1, inputStream, 100);
assertParameter(each, 1, inputStream);
}
}
}
@SuppressWarnings("deprecation")
@Test
public void assertSetUnicodeStream() throws SQLException, IOException {
for (PreparedStatement each : preparedStatements) {
try (InputStream inputStream = new ByteArrayInputStream(new byte[]{})) {
each.setUnicodeStream(1, inputStream, 100);
assertParameter(each, 1, inputStream);
}
}
}
@Override
public void setUnicodeStream(final int parameterIndex, final InputStream x,
final int length) throws SQLException {
ParameterCallback callback = new ParameterCallbackAction(
parameterIndex, x) {
@SuppressWarnings("deprecation")
@Override
public void call(PreparedStatement preparedStatement)
throws SQLException {
preparedStatement.setUnicodeStream(parameterIndex(), (InputStream)getParameter(), length);
}
};
addParameterCallback(callback);
}
@SuppressWarnings("deprecation")
@Override
public void setParam(PreparedStatement stmt) throws SQLException {
stmt.setUnicodeStream(index, (InputStream) values[0], (Integer) values[1]);
}