1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.buffer;
17
18 import io.netty.util.internal.PlatformDependent;
19
20 import java.nio.ByteBuffer;
21
22
23
24
25
26
27
28
29 final class VarHandleByteBufferAccess {
30
31 private VarHandleByteBufferAccess() {
32 }
33
34
35 static short getShortBE(ByteBuffer buffer, int index) {
36
37 return (short) PlatformDependent.shortBeByteBufferView().get(buffer, index);
38 }
39
40 static void setShortBE(ByteBuffer buffer, int index, int value) {
41
42 PlatformDependent.shortBeByteBufferView().set(buffer, index, (short) value);
43 }
44
45
46 static short getShortLE(ByteBuffer buffer, int index) {
47
48 return (short) PlatformDependent.shortLeByteBufferView().get(buffer, index);
49 }
50
51 static void setShortLE(ByteBuffer buffer, int index, int value) {
52
53 PlatformDependent.shortLeByteBufferView().set(buffer, index, (short) value);
54 }
55
56
57 static int getIntBE(ByteBuffer buffer, int index) {
58
59 return (int) PlatformDependent.intBeByteBufferView().get(buffer, index);
60 }
61
62 static void setIntBE(ByteBuffer buffer, int index, int value) {
63
64 PlatformDependent.intBeByteBufferView().set(buffer, index, value);
65 }
66
67
68 static int getIntLE(ByteBuffer buffer, int index) {
69
70 return (int) PlatformDependent.intLeByteBufferView().get(buffer, index);
71 }
72
73 static void setIntLE(ByteBuffer buffer, int index, int value) {
74
75 PlatformDependent.intLeByteBufferView().set(buffer, index, value);
76 }
77
78
79 static long getLongBE(ByteBuffer buffer, int index) {
80
81 return (long) PlatformDependent.longBeByteBufferView().get(buffer, index);
82 }
83
84 static void setLongBE(ByteBuffer buffer, int index, long value) {
85
86 PlatformDependent.longBeByteBufferView().set(buffer, index, value);
87 }
88
89
90 static long getLongLE(ByteBuffer buffer, int index) {
91
92 return (long) PlatformDependent.longLeByteBufferView().get(buffer, index);
93 }
94
95 static void setLongLE(ByteBuffer buffer, int index, long value) {
96
97 PlatformDependent.longLeByteBufferView().set(buffer, index, value);
98 }
99
100
101
102
103
104
105
106
107
108
109 static short getShortBE(byte[] memory, int index) {
110
111 return (short) PlatformDependent.shortBeArrayView().get(memory, index);
112 }
113
114 static void setShortBE(byte[] memory, int index, int value) {
115
116 PlatformDependent.shortBeArrayView().set(memory, index, (short) value);
117 }
118
119
120 static short getShortLE(byte[] memory, int index) {
121
122 return (short) PlatformDependent.shortLeArrayView().get(memory, index);
123 }
124
125 static void setShortLE(byte[] memory, int index, int value) {
126
127 PlatformDependent.shortLeArrayView().set(memory, index, (short) value);
128 }
129
130
131 static int getIntBE(byte[] memory, int index) {
132
133 return (int) PlatformDependent.intBeArrayView().get(memory, index);
134 }
135
136 static void setIntBE(byte[] memory, int index, int value) {
137
138 PlatformDependent.intBeArrayView().set(memory, index, value);
139 }
140
141
142 static int getIntLE(byte[] memory, int index) {
143
144 return (int) PlatformDependent.intLeArrayView().get(memory, index);
145 }
146
147 static void setIntLE(byte[] memory, int index, int value) {
148
149 PlatformDependent.intLeArrayView().set(memory, index, value);
150 }
151
152
153 static long getLongBE(byte[] memory, int index) {
154
155 return (long) PlatformDependent.longBeArrayView().get(memory, index);
156 }
157
158 static void setLongBE(byte[] memory, int index, long value) {
159
160 PlatformDependent.longBeArrayView().set(memory, index, value);
161 }
162
163
164 static long getLongLE(byte[] memory, int index) {
165
166 return (long) PlatformDependent.longLeArrayView().get(memory, index);
167 }
168
169 static void setLongLE(byte[] memory, int index, long value) {
170
171 PlatformDependent.longLeArrayView().set(memory, index, value);
172 }
173 }