当前位置: 首页>>代码示例>>Java>>正文


Java Encoder.hexEncode方法代码示例

本文整理汇总了Java中org.voltdb.utils.Encoder.hexEncode方法的典型用法代码示例。如果您正苦于以下问题:Java Encoder.hexEncode方法的具体用法?Java Encoder.hexEncode怎么用?Java Encoder.hexEncode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.utils.Encoder的用法示例。


在下文中一共展示了Encoder.hexEncode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileToCatalog

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public void compileToCatalog(Catalog catalog, Database db) throws VoltCompilerException {
    String hexDDL = Encoder.hexEncode(m_fullDDL);
    catalog.execute("set " + db.getPath() + " schema \"" + hexDDL + "\"");

    String xmlCatalog;
    try {
        xmlCatalog = m_hsql.getXMLFromCatalog();
    } catch (HSQLParseException e) {
        String msg = "DDL Error: " + e.getMessage();
        throw m_compiler.new VoltCompilerException(msg);
    }

    // output the xml catalog to disk
    PrintStream ddlXmlOutput = BuildDirectoryUtils.getDebugOutputPrintStream("schema-xml", "hsql-catalog-output.xml");
    ddlXmlOutput.println(xmlCatalog);
    ddlXmlOutput.close();

    // build the local catalog from the xml catalog
    fillCatalogFromXML(catalog, db, xmlCatalog);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:DDLCompiler.java

示例2: getHexEncodedBytes

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
 * Get a ascii-string-safe version of the binary value using a
 * hex encoding.
 *
 * @return A hex-encoded string value representing the serialized
 * objects.
 */
public String getHexEncodedBytes() {
    buffer.b.flip();
    byte bytes[] = new byte[buffer.b.remaining()];
    buffer.b.get(bytes);
    String hex = Encoder.hexEncode(bytes);
    buffer.discard();
    return hex;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:16,代码来源:FastSerializer.java

示例3: getHexEncodedBytes

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
 * Get a ascii-string-safe version of the binary value using a
 * hex encoding.
 *
 * @return A hex-encoded string value representing the serialized
 * objects.
 */
public String getHexEncodedBytes() {
    buffer.b().flip();
    byte bytes[] = new byte[buffer.b().remaining()];
    buffer.b().get(bytes);
    String hex = Encoder.hexEncode(bytes);
    buffer.discard();
    return hex;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:16,代码来源:FastSerializer.java

示例4: getCacheForCatalogHash

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
 * Get the global cache for a given hash of the catalog. Note that there can be only
 * one cache per catalogHash at a time.
 */
public synchronized static AdHocCompilerCache getCacheForCatalogHash(byte[] catalogHash) {
    String hashString = Encoder.hexEncode(catalogHash);
    AdHocCompilerCache cache = m_catalogHashMatch.getIfPresent(hashString);
    if (cache == null) {
        cache = new AdHocCompilerCache();
        m_catalogHashMatch.put(hashString, cache);
    }
    return cache;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:14,代码来源:AdHocCompilerCache.java

示例5: testUpdateCatalog

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
@Test
public void testUpdateCatalog() throws IOException {
    // only makes sense in pro (sysproc suite has a complementary test for community)
    if (VoltDB.instance().getConfig().m_isEnterprise) {
        String catalogHex = Encoder.hexEncode("blah");
        ByteBuffer msg = createMsg("@UpdateApplicationCatalog", catalogHex, "blah");
        ClientResponseImpl resp = m_ci.handleRead(msg, m_handler, m_cxn);
        assertNull(resp);
        ArgumentCaptor<LocalObjectMessage> captor = ArgumentCaptor.forClass(LocalObjectMessage.class);
        verify(m_messenger).send(eq(32L), // A fixed number set in setUpOnce()
                                 captor.capture());
        assertTrue(captor.getValue().payload instanceof CatalogChangeWork);
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:15,代码来源:TestClientInterface.java

示例6: toString

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
@Override
public String toString() {
    return Encoder.hexEncode(hashBytes);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:5,代码来源:Sha1Wrapper.java

示例7: report

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
 * Generate the HTML catalog report from a newly compiled VoltDB catalog
 */
public static String report(Catalog catalog, ArrayList<Feedback> warnings, String autoGenDDL) throws IOException {
    // asynchronously get platform properties
    new Thread() {
        @Override
        public void run() {
            PlatformProperties.getPlatformProperties();
        }
    }.start();


    URL url = Resources.getResource(ReportMaker.class, "template.html");
    String contents = Resources.toString(url, Charsets.UTF_8);

    Cluster cluster = catalog.getClusters().get("cluster");
    assert(cluster != null);
    Database db = cluster.getDatabases().get("database");
    assert(db != null);

    String statsData = getStatsHTML(db, warnings);
    contents = contents.replace("##STATS##", statsData);

    // generateProceduresTable needs to happen before generateSchemaTable
    // because some metadata used in the later is generated in the former
    String procData = generateProceduresTable(db.getTables(), db.getProcedures());
    contents = contents.replace("##PROCS##", procData);

    String schemaData = generateSchemaTable(db);
    contents = contents.replace("##SCHEMA##", schemaData);

    DatabaseSizes sizes = CatalogSizing.getCatalogSizes(db);

    String sizeData = generateSizeTable(sizes);
    contents = contents.replace("##SIZES##", sizeData);

    String sizeSummary = generateSizeSummary(sizes);
    contents = contents.replace("##SIZESUMMARY##", sizeSummary);

    String platformData = PlatformProperties.getPlatformProperties().toHTML();
    contents = contents.replace("##PLATFORM##", platformData);

    contents = contents.replace("##VERSION##", VoltDB.instance().getVersionString());

    contents = contents.replace("##DDL##", escapeHtml4(autoGenDDL));

    DateFormat df = new SimpleDateFormat("d MMM yyyy HH:mm:ss z");
    contents = contents.replace("##TIMESTAMP##", df.format(m_timestamp));

    String msg = Encoder.hexEncode(VoltDB.instance().getVersionString() + "," + System.currentTimeMillis());
    contents = contents.replace("get.py?a=KEY&", String.format("get.py?a=%s&", msg));

    return contents;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:56,代码来源:ReportMaker.java

示例8: testPartitionAndInsert

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public void testPartitionAndInsert () throws Exception {
    String my_schema =
            "create table BLAH (" +
            "clm_varinary varbinary(128) default '00' not null," +
            "clm_smallint smallint default 0 not null, " +
            ");";

        pathToCatalog = Configuration.getPathToCatalogForTest("csv.jar");
        pathToDeployment = Configuration.getPathToCatalogForTest("csv.xml");
        builder = new VoltProjectBuilder();

        builder.addLiteralSchema(my_schema);
        builder.addPartitionInfo("BLAH", "clm_varinary");
        //builder.addStmtProcedure("Insert", "INSERT into BLAH values (?, ?, ?, ?, ?, ?, ?);");
        boolean success = builder.compile(pathToCatalog, 2, 1, 0);
        assertTrue(success);
        MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
        config = new VoltDB.Configuration();
        config.m_pathToCatalog = pathToCatalog;
        config.m_pathToDeployment = pathToDeployment;
        localServer = new ServerThread(config);
        client = null;

        localServer.start();
        localServer.waitForInitialization();

        client = ClientFactory.createClient();
        client.createConnection("localhost");

        ClientResponse resp;
        resp = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES ('22',1);");
        assertEquals(1, resp.getResults()[0].asScalarLong());
        resp = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES ('80',3);" );
        assertEquals(1, resp.getResults()[0].asScalarLong());
        resp = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES ('8081828384858687888990',4);" );
        assertEquals(1, resp.getResults()[0].asScalarLong());

        Random rand = new Random();
        for( int i = 0; i < 1000; i++ ){
            byte[] bytes = new byte[rand.nextInt(128)];
            rand.nextBytes(bytes);
            // Just to mix things up, alternate methods of INSERT among
            // literal hex string, hex string parameter, and byte[] parameter.
            if ( i % 2 == 0 ) {
                String hexString = Encoder.hexEncode(bytes);
                if ( i % 4 == 0 ) {
                    resp = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES ('" + hexString + "',5);" );
                } else {
                    resp = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES (?,5);", hexString);
                }
            } else {
                resp = client.callProcedure("@AdHoc", "INSERT INTO BLAH VALUES (?,5);", bytes);
            }
            assertEquals(1, resp.getResults()[0].asScalarLong());
        }
        resp =  client.callProcedure("@AdHoc", "SELECT COUNT(*) FROM BLAH;");
        assertEquals(3 + 1000, resp.getResults()[0].asScalarLong());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:59,代码来源:TestVarBinaryPartition.java


注:本文中的org.voltdb.utils.Encoder.hexEncode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。