本文整理汇总了Java中javax.sql.rowset.serial.SerialBlob.setBytes方法的典型用法代码示例。如果您正苦于以下问题:Java SerialBlob.setBytes方法的具体用法?Java SerialBlob.setBytes怎么用?Java SerialBlob.setBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sql.rowset.serial.SerialBlob
的用法示例。
在下文中一共展示了SerialBlob.setBytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test22
import javax.sql.rowset.serial.SerialBlob; //导入方法依赖的package包/类
@Test
public void test22() throws Exception {
byte[] diff = new byte[]{7, 8, 9};
byte[] expected = new byte[]{1, 7, 8, 9, 5};
SerialBlob sb = new SerialBlob(bytes);
int written = sb.setBytes(2, diff);
assertEquals(written, diff.length);
assertTrue(
Arrays.equals(sb.getBytes(1, (int) sb.length()),
expected),
"arrays do not match ");
}
示例2: test23
import javax.sql.rowset.serial.SerialBlob; //导入方法依赖的package包/类
@Test
public void test23() throws Exception {
int bytesToWrite = 3;
byte[] diff = new byte[]{7, 8, 9, 0};
byte[] expected = new byte[]{1, 8, 9, 0, 5};
SerialBlob sb = new SerialBlob(bytes);
int written = sb.setBytes(2, diff, 1, bytesToWrite);
assertEquals(written, bytesToWrite);
assertTrue(
Arrays.equals(sb.getBytes(1, (int) sb.length()),
expected),
"arrays do not match ");
}
示例3: test08
import javax.sql.rowset.serial.SerialBlob; //导入方法依赖的package包/类
@Test(expectedExceptions = SerialException.class)
public void test08() throws Exception {
SerialBlob sb = new SerialBlob(new StubBlob());
sb.free();
sb.setBytes(1, new byte[5]);
}
示例4: test09
import javax.sql.rowset.serial.SerialBlob; //导入方法依赖的package包/类
@Test(expectedExceptions = SerialException.class)
public void test09() throws Exception {
SerialBlob sb = new SerialBlob(new StubBlob());
sb.free();
sb.setBytes(1, new byte[10], 0, 5);
}