MCPcopy Create free account
hub / github.com/apache/fory / readLatin1

Function readLatin1

go/fory/string.go:76–88  ·  view source on GitHub ↗

Specific encoding read methods

(buf *ByteBuffer, size int, err *Error)

Source from the content-addressed store, hash-verified

74
75// Specific encoding read methods
76func readLatin1(buf *ByteBuffer, size int, err *Error) string {
77 data := buf.ReadBinary(size, err)
78 if err.HasError() {
79 return ""
80 }
81 // Latin1 bytes need to be converted to UTF-8
82 // Each Latin1 byte is a single Unicode code point (0-255)
83 runes := make([]rune, size)
84 for i, b := range data {
85 runes[i] = rune(b)
86 }
87 return string(runes)
88}
89
90func readUTF16LE(buf *ByteBuffer, byteCount int, err *Error) string {
91 if byteCount&1 != 0 {

Callers 2

TestReadLatin1_OOM_BugFunction · 0.85
readStringFunction · 0.85

Calls 3

stringFunction · 0.50
ReadBinaryMethod · 0.45
HasErrorMethod · 0.45

Tested by 1

TestReadLatin1_OOM_BugFunction · 0.68