Skip to content

Commit

Permalink
remove some typo and blank
Browse files Browse the repository at this point in the history
  • Loading branch information
pyb1993 committed Jun 15, 2021
1 parent 836ab60 commit a8bc025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,4 @@ public void writeAsciiHuge (InputOutputState state) {
Output output = new Output(1024, 1024 * 512);
output.writeAscii(hugeString);
}

}
￿
}
12 changes: 6 additions & 6 deletions src/com/esotericsoftware/kryo/io/Output.java
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public void writeBoolean (boolean value) throws KryoException {
}

// String:

/** Writes the length and string, or null. Short strings are checked and if ASCII they are written more efficiently, else they
* are written as UTF8. If a string is known to be ASCII, {@link #writeAscii(String)} may be used. The string can be read using
* {@link Input#readString()} or {@link Input#readStringBuilder()}.
Expand All @@ -663,8 +663,6 @@ public void writeString (String value) throws KryoException {
if (charCount > 1 && charCount <= 32) {
for (int i = 0; i < charCount; i++)
if (value.charAt(i) > 127) break outer;

// todo can combine
if (capacity - position < charCount)
writeAscii_slow(value, charCount);
else {
Expand Down Expand Up @@ -694,7 +692,7 @@ public void writeString (String value) throws KryoException {
}
if (charIndex < charCount) writeUtf8_slow(value, charCount, charIndex);
}

/** 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
Expand Down Expand Up @@ -743,7 +741,7 @@ else if (c > 0x07FF) {
}
}
}

private void writeAscii_slow (String value, int charCount) throws KryoException {
if (charCount == 0) return;
if (position == capacity) require(1); // Must be able to write at least one character.
Expand All @@ -758,7 +756,9 @@ private void writeAscii_slow (String value, int charCount) throws KryoException
if (require(charsToWrite)) buffer = this.buffer;
}
}


// Primitive arrays:

/** Writes an int array in bulk. This may be more efficient than writing them individually. */
public void writeInts (int[] array, int offset, int count) throws KryoException {
if (capacity >= count << 2) {
Expand Down

0 comments on commit a8bc025

Please sign in to comment.