本文整理汇总了Java中javax.sql.rowset.serial.SerialBlob类的典型用法代码示例。如果您正苦于以下问题:Java SerialBlob类的具体用法?Java SerialBlob怎么用?Java SerialBlob使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerialBlob类属于javax.sql.rowset.serial包,在下文中一共展示了SerialBlob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test30
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@Test
public void test30() throws Exception {
long expectedPos = 3; // starting offset is 1 vs 0
byte[] pattern = new byte[]{6, 8};
SerialBlob sb = new SerialBlob(new StubBlob());
long pos = sb.position(pattern, 2);
assertEquals(pos, expectedPos);
}
示例2: saveRequest
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@SneakyThrows
public AuditFuture saveRequest(Buffer requestBuffer) {
Audit audit = new Audit()
.setGateway(gatewayManager.getCurrentGateway())
.setTid(getTid())
.setAlias(getAlias())
.setUri(context.request().absoluteURI())
.setHeaders(getHeaders())
.setRequestContent(new SerialBlob(requestBuffer.getBytes()));
persist(audit, res -> {
if(res.succeeded()){
createFuture.complete(res.result());
}else{
createFuture.fail(res.cause());
}
});
return this;
}
示例3: saveResponse
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@SneakyThrows
public void saveResponse(Record record, Buffer responseBuffer) {
createFuture.setHandler(res -> {
try {
Audit audit = res.result();
audit
.setRecord(record.toJson())
.setResponseCode(context.response().getStatusCode())
.setResponseContent(new SerialBlob(Optional.ofNullable(responseBuffer)
.orElse(Buffer.buffer()).getBytes()
));
persist(audit, this::notifyAuditResult);
} catch (Exception e) {
log.error("Fail to save response");
}
});
}
示例4: saveAttachmentEntity
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
private void saveAttachmentEntity() throws SQLException {
AttachmentContentEntity attachment = new AttachmentContentEntity();
attachment.setSize(123456);
attachment.setHashSha1("SHA-1");
attachment.setContent(new SerialBlob("A simple blob with value".getBytes()));
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH)-2);
attachment.setInclusionDate(calendar.getTime());
attachmentContentDao.insert(attachment);
AttachmentEntity entity = new AttachmentEntity();
entity.setCreationDate(calendar.getTime());
entity.setHashSha1("SHA1");
entity.setName("name");
entity.setSize(3512);
entity.setCodContent(attachment.getCod());
attachmentDao.insert(entity);
}
示例5: getBlob
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@Override
public Blob getBlob(int columnIndex) throws SQLException {
checkColumnBounds(columnIndex);
try {
return new SerialBlob(table.getStringAsBytes(columnIndex - 1));
} catch (Exception x) {
throw SQLError.get(x);
}
}
示例6: StoredDocumentControllerNoDeleteTests
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
public StoredDocumentControllerNoDeleteTests() throws SQLException {
documentContent = new DocumentContent(new SerialBlob("some xml".getBytes(StandardCharsets.UTF_8)));
documentContentVersion = DocumentContentVersion.builder()
.id(id)
.mimeType("text/plain")
.originalDocumentName("filename.txt")
.storedDocument(StoredDocument.builder().id(id).folder(Folder.builder().id(id).build()).build())
.documentContent(documentContent).build();
storedDocument = StoredDocument.builder().id(id)
.folder(Folder.builder().id(id).build()).documentContentVersions(
Stream.of(documentContentVersion)
.collect(Collectors.toList())
).build();
}
开发者ID:hmcts,项目名称:document-management-store-app,代码行数:15,代码来源:StoredDocumentControllerNoDeleteTests.java
示例7: param
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
public String param(SerialBlob blVal)
{
if(m_arrParams == null)
m_arrParams = new ArrayList<ColValue>();
ColValue colVal = new ColValueBlob("", blVal);
m_arrParams.add(colVal);
return "?";
}
示例8: paramInsert
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
public SQLClause paramInsert(String csName, SerialBlob blVal)
{
if(m_arrInsertParams == null)
m_arrInsertParams = new ArrayList<ColValue>();
ColValue colVal = new ColValueBlob(csName, blVal);
m_arrInsertParams.add(colVal);
return this;
}
示例9: toBlob
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
public static Blob toBlob(String s) {
if (s == null || "".equals(s)) {
return null;
} else {
try {
return new SerialBlob(s.getBytes());
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
return null;
}
}
示例10: toClob
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
public static Blob toClob(String s) {
if (s == null || "".equals(s)) {
return null;
} else {
try {
return new SerialBlob(s.getBytes());
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
return null;
}
}
示例11: testAdvancedParameters
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@DataProvider(name = "testAdvancedParameters")
private Object[][] testAdvancedParameters() throws SQLException {
byte[] bytes = new byte[10];
Ref aRef = new SerialRef(new StubRef("INTEGER", query));
Array aArray = new SerialArray(new StubArray("INTEGER", new Object[1]));
Blob aBlob = new SerialBlob(new StubBlob());
Clob aClob = new SerialClob(new StubClob());
Reader rdr = new StringReader(query);
InputStream is = new StringBufferInputStream(query);;
brs = new StubBaseRowSet();
brs.setBytes(1, bytes);
brs.setAsciiStream(2, is, query.length());
brs.setRef(3, aRef);
brs.setArray(4, aArray);
brs.setBlob(5, aBlob);
brs.setClob(6, aClob);
brs.setBinaryStream(7, is, query.length());
brs.setUnicodeStream(8, is, query.length());
brs.setCharacterStream(9, rdr, query.length());
return new Object[][]{
{1, bytes},
{2, is},
{3, aRef},
{4, aArray},
{5, aBlob},
{6, aClob},
{7, is},
{8, is},
{9, rdr}
};
}
示例12: test05
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@Test(enabled = true)
public void test05() throws Exception {
Blob b = new StubBlob();
outImpl.writeBlob(b);
SerialBlob sb = (SerialBlob) results.get(0);
assertTrue(Arrays.equals(
b.getBytes(1, (int) b.length()),
sb.getBytes(1, (int) sb.length())));
}
示例13: test11
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@Test
public void test11() throws Exception {
byte[] expected = new byte[]{1, 2, 3};
SerialBlob sb = new SerialBlob(bytes);
InputStream is = sb.getBinaryStream(1, 3);
for (byte b : expected) {
byte val = (byte) is.read();
assertTrue(b == val, val + " does not match " + b);
}
}
示例14: test18
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@Test
public void test18() throws Exception {
SerialBlob sb = new SerialBlob(bytes);
SerialBlob sb2 = (SerialBlob) sb.clone();
assertTrue(
Arrays.equals(sb.getBytes(1, (int) sb.length()),
sb2.getBytes(1, (int) sb2.length())),
"arrays do not match ");
}
示例15: test19
import javax.sql.rowset.serial.SerialBlob; //导入依赖的package包/类
@Test(expectedExceptions = SerialException.class)
public void test19() throws Exception {
SerialBlob sb = new SerialBlob(bytes);
sb.free();
SerialBlob sb2 = (SerialBlob) sb.clone();
InputStream is = sb2.getBinaryStream(1, 3);
}