本文整理匯總了Java中com.mysql.jdbc.StringUtils.getBytes方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.getBytes方法的具體用法?Java StringUtils.getBytes怎麽用?Java StringUtils.getBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.mysql.jdbc.StringUtils
的用法示例。
在下文中一共展示了StringUtils.getBytes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: nextAuthenticationStep
import com.mysql.jdbc.StringUtils; //導入方法依賴的package包/類
public boolean nextAuthenticationStep(Buffer fromServer, List<Buffer> toServer) throws SQLException {
toServer.clear();
Buffer bresp = new Buffer(StringUtils.getBytes(this.password));
toServer.add(bresp);
return true;
}
示例2: pack
import com.mysql.jdbc.StringUtils; //導入方法依賴的package包/類
/**
* Creates a binary representation of this event.
*
* @return a binary representation of this event
* @throws Exception
* if an error occurs while packing this event.
*/
public byte[] pack() throws Exception {
int len = 1 + 4 + 4 + 4 + 8 + 4 + 4;
byte[] eventCreationAsBytes = null;
getEventCreationPointAsString();
if (this.eventCreationPointDesc != null) {
eventCreationAsBytes = StringUtils.getBytes(this.eventCreationPointDesc, "ISO8859_1");
len += (4 + eventCreationAsBytes.length);
} else {
len += 4;
}
byte[] messageAsBytes = null;
if (this.message != null) {
messageAsBytes = StringUtils.getBytes(this.message, "ISO8859_1");
len += (4 + messageAsBytes.length);
} else {
len += 4;
}
byte[] durationUnitsAsBytes = null;
if (this.durationUnits != null) {
durationUnitsAsBytes = StringUtils.getBytes(this.durationUnits, "ISO8859_1");
len += (4 + durationUnitsAsBytes.length);
} else {
len += 4;
durationUnitsAsBytes = StringUtils.getBytes("", "ISO8859_1");
}
byte[] buf = new byte[len];
int pos = 0;
buf[pos++] = this.eventType;
pos = writeLong(this.connectionId, buf, pos);
pos = writeInt(this.statementId, buf, pos);
pos = writeInt(this.resultSetId, buf, pos);
pos = writeLong(this.eventCreationTime, buf, pos);
pos = writeLong(this.eventDuration, buf, pos);
pos = writeBytes(durationUnitsAsBytes, buf, pos);
pos = writeInt(this.eventCreationPointIndex, buf, pos);
if (eventCreationAsBytes != null) {
pos = writeBytes(eventCreationAsBytes, buf, pos);
} else {
pos = writeInt(0, buf, pos);
}
if (messageAsBytes != null) {
pos = writeBytes(messageAsBytes, buf, pos);
} else {
pos = writeInt(0, buf, pos);
}
return buf;
}