本文整理了Java中com.esotericsoftware.kryo.io.Output.writeAscii_slow()
方法的一些代码示例,展示了Output.writeAscii_slow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.writeAscii_slow()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.io.Output
类名称:Output
方法名:writeAscii_slow
暂无
代码示例来源:origin: svn2github/kryo
/** Writes a string that is known to contain only ASCII characters. Non-ASCII strings passed to this method will be corrupted.
* Each byte is a 7 bit character with the remaining byte denoting if another character is available. This is slightly more
* efficient than {@link #writeString(String)}. The string can be read using {@link Input#readString()} or
* {@link Input#readStringBuilder()}.
* @param value May be null. */
public void writeAscii (String value) throws KryoException {
if (value == null) {
writeByte(0x80); // 0 means null, bit 8 means UTF8.
return;
}
int charCount = value.length();
if (charCount == 0) {
writeByte(1 | 0x80); // 1 means empty string, bit 8 means UTF8.
return;
}
if (capacity - position < charCount)
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
position += charCount;
}
buffer[position - 1] |= 0x80; // Bit 8 means end of ASCII.
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Writes a string that is known to contain only ASCII characters. Non-ASCII strings passed to this method will be corrupted.
* Each byte is a 7 bit character with the remaining byte denoting if another character is available. This is slightly more
* efficient than {@link #writeString(String)}. The string can be read using {@link Input#readString()} or
* {@link Input#readStringBuilder()}.
* @param value May be null. */
public void writeAscii (String value) throws KryoException {
if (value == null) {
writeByte(0x80); // 0 means null, bit 8 means UTF8.
return;
}
int charCount = value.length();
switch (charCount) {
case 0:
writeByte(1 | 0x80); // 1 is string length + 1, bit 8 means UTF8.
return;
case 1:
writeByte(2 | 0x80); // 2 is string length + 1, bit 8 means UTF8.
writeByte(value.charAt(0));
return;
}
if (capacity - position < charCount)
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
position += charCount;
}
buffer[position - 1] |= 0x80; // Bit 8 means end of ASCII.
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Writes a string that is known to contain only ASCII characters. Non-ASCII strings passed to this method will be corrupted.
* Each byte is a 7 bit character with the remaining byte denoting if another character is available. This is slightly more
* efficient than {@link #writeString(String)}. The string can be read using {@link Input#readString()} or
* {@link Input#readStringBuilder()}.
* @param value May be null. */
public void writeAscii (String value) throws KryoException {
if (value == null) {
writeByte(0x80); // 0 means null, bit 8 means UTF8.
return;
}
int charCount = value.length();
switch (charCount) {
case 0:
writeByte(1 | 0x80); // 1 is string length + 1, bit 8 means UTF8.
return;
case 1:
writeByte(2 | 0x80); // 2 is string length + 1, bit 8 means UTF8.
writeByte(value.charAt(0));
return;
}
if (capacity - position < charCount)
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
position += charCount;
}
buffer[position - 1] |= 0x80; // Bit 8 means end of ASCII.
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Writes a string that is known to contain only ASCII characters. Non-ASCII strings passed to this method will be corrupted.
* Each byte is a 7 bit character with the remaining byte denoting if another character is available. This is slightly more
* efficient than {@link #writeString(String)}. The string can be read using {@link Input#readString()} or
* {@link Input#readStringBuilder()}.
* @param value May be null. */
public void writeAscii (String value) throws KryoException {
if (value == null) {
writeByte(0x80); // 0 means null, bit 8 means UTF8.
return;
}
int charCount = value.length();
switch (charCount) {
case 0:
writeByte(1 | 0x80); // 1 is string length + 1, bit 8 means UTF8.
return;
case 1:
writeByte(2 | 0x80); // 2 is string length + 1, bit 8 means UTF8.
writeByte(value.charAt(0));
return;
}
if (capacity - position < charCount)
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
position += charCount;
}
buffer[position - 1] |= 0x80; // Bit 8 means end of ASCII.
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
代码示例来源:origin: com.esotericsoftware/kryo
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
代码示例来源:origin: svn2github/kryo
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
代码示例来源:origin: com.esotericsoftware/kryo-shaded
writeAscii_slow(value, charCount);
else {
value.getBytes(0, charCount, buffer, position);
内容来源于网络,如有侵权,请联系作者删除!