|
27 | 27 | */ |
28 | 28 | public interface StaticBuffer extends Comparable<StaticBuffer> { |
29 | 29 |
|
30 | | - public int length(); |
| 30 | + int length(); |
31 | 31 |
|
32 | | - public byte getByte(int position); |
| 32 | + byte getByte(int position); |
33 | 33 |
|
34 | | - public boolean getBoolean(int position); |
| 34 | + boolean getBoolean(int position); |
35 | 35 |
|
36 | | - public short getShort(int position); |
| 36 | + short getShort(int position); |
37 | 37 |
|
38 | | - public int getInt(int position); |
| 38 | + int getInt(int position); |
39 | 39 |
|
40 | | - public long getLong(int position); |
| 40 | + long getLong(int position); |
41 | 41 |
|
42 | | - public char getChar(int position); |
| 42 | + char getChar(int position); |
43 | 43 |
|
44 | | - public float getFloat(int position); |
| 44 | + float getFloat(int position); |
45 | 45 |
|
46 | | - public double getDouble(int position); |
| 46 | + double getDouble(int position); |
47 | 47 |
|
48 | | - public byte[] getBytes(int position, int length); |
| 48 | + byte[] getBytes(int position, int length); |
49 | 49 |
|
50 | | - public short[] getShorts(int position, int length); |
| 50 | + short[] getShorts(int position, int length); |
51 | 51 |
|
52 | | - public int[] getInts(int position, int length); |
| 52 | + int[] getInts(int position, int length); |
53 | 53 |
|
54 | | - public long[] getLongs(int position, int length); |
| 54 | + long[] getLongs(int position, int length); |
55 | 55 |
|
56 | | - public char[] getChars(int position, int length); |
| 56 | + char[] getChars(int position, int length); |
57 | 57 |
|
58 | | - public float[] getFloats(int position, int length); |
| 58 | + float[] getFloats(int position, int length); |
59 | 59 |
|
60 | | - public double[] getDoubles(int position, int length); |
| 60 | + double[] getDoubles(int position, int length); |
61 | 61 |
|
62 | | - public StaticBuffer subrange(int position, int length); |
| 62 | + StaticBuffer subrange(int position, int length); |
63 | 63 |
|
64 | | - public StaticBuffer subrange(int position, int length, boolean invert); |
| 64 | + StaticBuffer subrange(int position, int length, boolean invert); |
65 | 65 |
|
66 | | - public ReadBuffer asReadBuffer(); |
| 66 | + ReadBuffer asReadBuffer(); |
67 | 67 |
|
68 | | - public<T> T as(Factory<T> factory); |
| 68 | + <T> T as(Factory<T> factory); |
69 | 69 |
|
70 | 70 | //Convenience method |
71 | | - public ByteBuffer asByteBuffer(); |
| 71 | + ByteBuffer asByteBuffer(); |
72 | 72 |
|
73 | | - public interface Factory<T> { |
| 73 | + interface Factory<T> { |
74 | 74 |
|
75 | | - public T get(byte[] array, int offset, int limit); |
| 75 | + T get(byte[] array, int offset, int limit); |
76 | 76 |
|
77 | 77 | } |
78 | 78 |
|
79 | | - public static final Factory<byte[]> ARRAY_FACTORY = new Factory<byte[]>() { |
80 | | - @Override |
81 | | - public byte[] get(byte[] array, int offset, int limit) { |
82 | | - if (offset==0 && limit==array.length) return array; |
83 | | - else return Arrays.copyOfRange(array,offset,limit); |
84 | | - } |
85 | | - |
| 79 | + Factory<byte[]> ARRAY_FACTORY = (array, offset, limit) -> { |
| 80 | + if (offset==0 && limit==array.length) return array; |
| 81 | + else return Arrays.copyOfRange(array,offset,limit); |
86 | 82 | }; |
87 | 83 |
|
88 | | - public static final Factory<ByteBuffer> BB_FACTORY = new Factory<ByteBuffer>() { |
89 | | - @Override |
90 | | - public ByteBuffer get(byte[] array, int offset, int limit) { |
91 | | - return ByteBuffer.wrap(array, offset, limit - offset); |
92 | | - } |
93 | | - }; |
| 84 | + Factory<ByteBuffer> BB_FACTORY = (array, offset, limit) -> ByteBuffer.wrap(array, offset, limit - offset); |
94 | 85 |
|
95 | | - public static final Factory<StaticBuffer> STATIC_FACTORY = new Factory<StaticBuffer>() { |
96 | | - @Override |
97 | | - public StaticBuffer get(byte[] array, int offset, int limit) { |
98 | | - return new StaticArrayBuffer(array, offset, limit); |
99 | | - } |
100 | | - }; |
| 86 | + Factory<StaticBuffer> STATIC_FACTORY = (array, offset, limit) -> new StaticArrayBuffer(array, offset, limit); |
101 | 87 |
|
102 | 88 | } |
0 commit comments