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


Java SerialBlob類代碼示例

本文整理匯總了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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:9,代碼來源:SerialBlobTests.java

示例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;
}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:24,代碼來源:AuditFuture.java

示例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");
		}
	});
}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:23,代碼來源:AuditFuture.java

示例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);
}
 
開發者ID:opensingular,項目名稱:singular-server,代碼行數:21,代碼來源:AttachmentGCTest.java

示例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);
    }
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:10,代碼來源:JDBC4ResultSet.java

示例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 "?";
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:10,代碼來源:SQLClause.java

示例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;
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:10,代碼來源:SQLClause.java

示例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;
	}
}
 
開發者ID:fier-liu,項目名稱:FCat,代碼行數:13,代碼來源:StrUtil.java

示例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;
	}
}
 
開發者ID:fier-liu,項目名稱:FCat,代碼行數:13,代碼來源:StrUtil.java

示例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}
    };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:34,代碼來源:BaseRowSetTests.java

示例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())));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:10,代碼來源:SQLOutputImplTests.java

示例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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:SerialBlobTests.java

示例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 ");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:10,代碼來源:SerialBlobTests.java

示例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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:SerialBlobTests.java


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