MCPcopy Create free account
hub / github.com/Hiro420/NikkeTools / parse_endianness

Method parse_endianness

UnLuac/src/unluac/parse/LHeaderType.java:99–117  ·  view source on GitHub ↗
(ByteBuffer buffer, BHeader header, LHeaderParseState s)

Source from the content-addressed store, hash-verified

97 }
98
99 protected void parse_endianness(ByteBuffer buffer, BHeader header, LHeaderParseState s) {
100 // 1 byte endianness
101 int endianness = 0xFF & buffer.get();
102 switch(endianness) {
103 case 0:
104 s.endianness = LHeader.LEndianness.BIG;
105 buffer.order(ByteOrder.BIG_ENDIAN);
106 break;
107 case 1:
108 s.endianness = LHeader.LEndianness.LITTLE;
109 buffer.order(ByteOrder.LITTLE_ENDIAN);
110 break;
111 default:
112 throw new IllegalStateException("The input chunk reports an invalid endianness: " + endianness);
113 }
114 if(header.debug) {
115 System.out.println("-- endianness: " + endianness + (endianness == 0 ? " (big)" : " (little)"));
116 }
117 }
118
119 protected void write_endianness(OutputStream out, BHeader header, LHeader object) throws IOException {
120 int value;

Callers 3

parse_mainMethod · 0.80
parse_mainMethod · 0.80
parse_mainMethod · 0.80

Calls 2

printlnMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected