@@ -643,7 +643,7 @@ public void writeBoolean (boolean value) throws KryoException {
643
643
}
644
644
645
645
// String:
646
-
646
+
647
647
/** Writes the length and string, or null. Short strings are checked and if ASCII they are written more efficiently, else they
648
648
* are written as UTF8. If a string is known to be ASCII, {@link #writeAscii(String)} may be used. The string can be read using
649
649
* {@link Input#readString()} or {@link Input#readStringBuilder()}.
@@ -663,8 +663,6 @@ public void writeString (String value) throws KryoException {
663
663
if (charCount > 1 && charCount <= 32 ) {
664
664
for (int i = 0 ; i < charCount ; i ++)
665
665
if (value .charAt (i ) > 127 ) break outer ;
666
-
667
- // todo can combine
668
666
if (capacity - position < charCount )
669
667
writeAscii_slow (value , charCount );
670
668
else {
@@ -694,7 +692,7 @@ public void writeString (String value) throws KryoException {
694
692
}
695
693
if (charIndex < charCount ) writeUtf8_slow (value , charCount , charIndex );
696
694
}
697
-
695
+
698
696
/** Writes a string that is known to contain only ASCII characters. Non-ASCII strings passed to this method will be corrupted.
699
697
* Each byte is a 7 bit character with the remaining byte denoting if another character is available. This is slightly more
700
698
* efficient than {@link #writeString(String)}. The string can be read using {@link Input#readString()} or
@@ -743,7 +741,7 @@ else if (c > 0x07FF) {
743
741
}
744
742
}
745
743
}
746
-
744
+
747
745
private void writeAscii_slow (String value , int charCount ) throws KryoException {
748
746
if (charCount == 0 ) return ;
749
747
if (position == capacity ) require (1 ); // Must be able to write at least one character.
@@ -758,7 +756,9 @@ private void writeAscii_slow (String value, int charCount) throws KryoException
758
756
if (require (charsToWrite )) buffer = this .buffer ;
759
757
}
760
758
}
761
-
759
+
760
+ // Primitive arrays:
761
+
762
762
/** Writes an int array in bulk. This may be more efficient than writing them individually. */
763
763
public void writeInts (int [] array , int offset , int count ) throws KryoException {
764
764
if (capacity >= count << 2 ) {
0 commit comments