MCPcopy
hub / github.com/libgdx/libgdx / writeString

Method writeString

gdx/src/com/badlogic/gdx/utils/DataOutput.java:61–80  ·  view source on GitHub ↗

Writes a length and then the string as UTF8. @param value May be null.

(@Null String value)

Source from the content-addressed store, hash-verified

59 /** Writes a length and then the string as UTF8.
60 * @param value May be null. */
61 public void writeString (@Null String value) throws IOException {
62 if (value == null) {
63 write(0);
64 return;
65 }
66 int charCount = value.length();
67 if (charCount == 0) {
68 writeByte(1);
69 return;
70 }
71 writeInt(charCount + 1, true);
72 // Try to write 8 bit chars.
73 int charIndex = 0;
74 for (; charIndex < charCount; charIndex++) {
75 int c = value.charAt(charIndex);
76 if (c > 127) break;
77 write((byte)c);
78 }
79 if (charIndex < charCount) writeString_slow(value, charCount, charIndex);
80 }
81
82 private void writeString_slow (String value, int charCount, int charIndex) throws IOException {
83 for (; charIndex < charCount; charIndex++) {

Callers 5

mainMethod · 0.45
getShaderMethod · 0.45
createShaderMethod · 0.45
writeFontMethod · 0.45
saveMethod · 0.45

Calls 6

writeMethod · 0.95
writeByteMethod · 0.95
writeIntMethod · 0.95
writeString_slowMethod · 0.95
lengthMethod · 0.45
charAtMethod · 0.45

Tested by 3

mainMethod · 0.36
getShaderMethod · 0.36
createShaderMethod · 0.36