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


Java StringUtils.toString方法代碼示例

本文整理匯總了Java中com.mysql.jdbc.StringUtils.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.toString方法的具體用法?Java StringUtils.toString怎麽用?Java StringUtils.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.mysql.jdbc.StringUtils的用法示例。


在下文中一共展示了StringUtils.toString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readString

import com.mysql.jdbc.StringUtils; //導入方法依賴的package包/類
private String readString(final ByteBuffer byteBuffer) {
    int i = byteBuffer.position();
    int len = 0;
    int maxLen = byteBuffer.limit();

    while ((i < maxLen) && (byteBuffer.get(i) != 0)) {
        len++;
        i++;
    }

    String s = StringUtils.toString(byteBuffer.array(), byteBuffer.position(), len);
    byteBuffer.position(byteBuffer.position() + len + 1);

    return s;
}
 
開發者ID:mongodb,項目名稱:mongosql-auth-java,代碼行數:16,代碼來源:MongoSqlAuthenticationPlugin.java

示例2: unpack

import com.mysql.jdbc.StringUtils; //導入方法依賴的package包/類
/**
 * Unpacks a binary representation of this event.
 * 
 * @param buf
 *            the binary representation of this event
 * @return the unpacked Event
 * @throws Exception
 *             if an error occurs while unpacking the event
 */
public static ProfilerEvent unpack(byte[] buf) throws Exception {
    int pos = 0;

    byte eventType = buf[pos++];
    long connectionId = readInt(buf, pos);
    pos += 8;
    int statementId = readInt(buf, pos);
    pos += 4;
    int resultSetId = readInt(buf, pos);
    pos += 4;
    long eventCreationTime = readLong(buf, pos);
    pos += 8;
    long eventDuration = readLong(buf, pos);
    pos += 4;

    byte[] eventDurationUnits = readBytes(buf, pos);
    pos += 4;

    if (eventDurationUnits != null) {
        pos += eventDurationUnits.length;
    }

    readInt(buf, pos);
    pos += 4;
    byte[] eventCreationAsBytes = readBytes(buf, pos);
    pos += 4;

    if (eventCreationAsBytes != null) {
        pos += eventCreationAsBytes.length;
    }

    byte[] message = readBytes(buf, pos);
    pos += 4;

    if (message != null) {
        pos += message.length;
    }

    return new ProfilerEvent(eventType, "", "", connectionId, statementId, resultSetId, eventCreationTime, eventDuration,
            StringUtils.toString(eventDurationUnits, "ISO8859_1"), StringUtils.toString(eventCreationAsBytes, "ISO8859_1"), null,
            StringUtils.toString(message, "ISO8859_1"));
}
 
開發者ID:bragex,項目名稱:the-vigilantes,代碼行數:52,代碼來源:ProfilerEvent.java

示例3: unpack

import com.mysql.jdbc.StringUtils; //導入方法依賴的package包/類
/**
 * Unpacks a binary representation of this event.
 * 
 * @param buf
 *            the binary representation of this event
 * @return the unpacked Event
 * @throws Exception
 *             if an error occurs while unpacking the event
 */
public static ProfilerEvent unpack(byte[] buf) throws Exception {
    int pos = 0;

    byte eventType = buf[pos++];
    long connectionId = readInt(buf, pos);
    pos += 8;
    int statementId = readInt(buf, pos);
    pos += 4;
    int resultSetId = readInt(buf, pos);
    pos += 4;
    long eventCreationTime = readLong(buf, pos);
    pos += 8;
    long eventDuration = readLong(buf, pos);
    pos += 4;

    byte[] eventDurationUnits = readBytes(buf, pos);
    pos += 4;

    if (eventDurationUnits != null) {
        pos += eventDurationUnits.length;
    }

    readInt(buf, pos);
    pos += 4;
    byte[] eventCreationAsBytes = readBytes(buf, pos);
    pos += 4;

    if (eventCreationAsBytes != null) {
        pos += eventCreationAsBytes.length;
    }

    byte[] message = readBytes(buf, pos);
    pos += 4;

    if (message != null) {
        pos += message.length;
    }

    return new ProfilerEvent(eventType, "", "", connectionId, statementId, resultSetId, eventCreationTime, eventDuration, StringUtils.toString(
            eventDurationUnits, "ISO8859_1"), StringUtils.toString(eventCreationAsBytes, "ISO8859_1"), null, StringUtils.toString(message, "ISO8859_1"));
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:51,代碼來源:ProfilerEvent.java


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