1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.buffer;
18
19 import io.netty.util.internal.PlatformDependent;
20
21
22
23
24 final class UnsafeDirectSwappedByteBuf extends AbstractUnsafeSwappedByteBuf {
25
26 UnsafeDirectSwappedByteBuf(AbstractByteBuf buf) {
27 super(buf);
28 }
29
30 private static long addr(AbstractByteBuf wrapped, int index) {
31
32
33
34
35 return wrapped.memoryAddress() + index;
36 }
37
38 @Override
39 protected long _getLong(AbstractByteBuf wrapped, int index) {
40 return PlatformDependent.getLong(addr(wrapped, index));
41 }
42
43 @Override
44 protected int _getInt(AbstractByteBuf wrapped, int index) {
45 return PlatformDependent.getInt(addr(wrapped, index));
46 }
47
48 @Override
49 protected short _getShort(AbstractByteBuf wrapped, int index) {
50 return PlatformDependent.getShort(addr(wrapped, index));
51 }
52
53 @Override
54 protected void _setShort(AbstractByteBuf wrapped, int index, short value) {
55 PlatformDependent.putShort(addr(wrapped, index), value);
56 }
57
58 @Override
59 protected void _setInt(AbstractByteBuf wrapped, int index, int value) {
60 PlatformDependent.putInt(addr(wrapped, index), value);
61 }
62
63 @Override
64 protected void _setLong(AbstractByteBuf wrapped, int index, long value) {
65 PlatformDependent.putLong(addr(wrapped, index), value);
66 }
67 }