mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Speed-up buffers that wrap ByteBuffer
This commit is contained in:
parent
ed6e6ae373
commit
3489f3c82c
|
@ -171,46 +171,51 @@ class TByteBufferImpl extends TByteBuffer {
|
|||
@Override
|
||||
public TCharBuffer asCharBuffer() {
|
||||
int sz = remaining() / 2;
|
||||
TCharBufferOverByteBuffer result = new TCharBufferOverByteBuffer(start + position, sz, this, 0, sz,
|
||||
isReadOnly());
|
||||
result.byteOrder = order;
|
||||
return result;
|
||||
if (order == TByteOrder.BIG_ENDIAN) {
|
||||
return new TCharBufferOverByteBufferBigEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
} else {
|
||||
return new TCharBufferOverByteBufferLittleEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TShortBuffer asShortBuffer() {
|
||||
int sz = remaining() / 2;
|
||||
TShortBufferOverByteBuffer result = new TShortBufferOverByteBuffer(start + position, sz, this, 0, sz,
|
||||
isReadOnly());
|
||||
result.byteOrder = order;
|
||||
return result;
|
||||
if (order == TByteOrder.BIG_ENDIAN) {
|
||||
return new TShortBufferOverByteBufferBigEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
} else {
|
||||
return new TShortBufferOverByteBufferLittleEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TIntBuffer asIntBuffer() {
|
||||
int sz = remaining() / 4;
|
||||
TIntBufferOverByteBuffer result = new TIntBufferOverByteBuffer(start + position, sz, this, 0, sz,
|
||||
isReadOnly());
|
||||
result.byteOrder = order;
|
||||
return result;
|
||||
if (order == TByteOrder.BIG_ENDIAN) {
|
||||
return new TIntBufferOverByteBufferBigEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
} else {
|
||||
return new TIntBufferOverByteBufferLittleEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TLongBuffer asLongBuffer() {
|
||||
int sz = remaining() / 8;
|
||||
TLongBufferOverByteBuffer result = new TLongBufferOverByteBuffer(start + position, sz, this, 0, sz,
|
||||
isReadOnly());
|
||||
result.byteOrder = order;
|
||||
return result;
|
||||
if (order == TByteOrder.BIG_ENDIAN) {
|
||||
return new TLongBufferOverByteBufferBigEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
} else {
|
||||
return new TLongBufferOverByteBufferLittleEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TFloatBuffer asFloatBuffer() {
|
||||
int sz = remaining() / 4;
|
||||
TFloatBufferOverByteBuffer result = new TFloatBufferOverByteBuffer(start + position, sz, this, 0, sz,
|
||||
isReadOnly());
|
||||
result.byteOrder = order;
|
||||
return result;
|
||||
if (order == TByteOrder.LITTLE_ENDIAN) {
|
||||
return new TFloatBufferOverByteBufferBigEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
} else {
|
||||
return new TFloatBufferOverByteBufferLittleEndian(start + position, sz, this, 0, sz, isReadOnly());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,11 +19,10 @@ package org.teavm.classlib.java.nio;
|
|||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TCharBufferOverByteBuffer extends TCharBufferImpl {
|
||||
private TByteBufferImpl byteByffer;
|
||||
TByteOrder byteOrder = TByteOrder.BIG_ENDIAN;
|
||||
abstract class TCharBufferOverByteBuffer extends TCharBufferImpl {
|
||||
TByteBufferImpl byteByffer;
|
||||
boolean readOnly;
|
||||
private int start;
|
||||
int start;
|
||||
|
||||
public TCharBufferOverByteBuffer(int start, int capacity, TByteBufferImpl byteBuffer, int position, int limit,
|
||||
boolean readOnly) {
|
||||
|
@ -33,38 +32,6 @@ class TCharBufferOverByteBuffer extends TCharBufferImpl {
|
|||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
TCharBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
TCharBufferOverByteBuffer result = new TCharBufferOverByteBuffer(this.start + start * 2, capacity, byteByffer,
|
||||
position, limit, readOnly);
|
||||
result.byteOrder = byteOrder;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
char getChar(int index) {
|
||||
int value;
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
value = ((byteByffer.array[start + index * 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2 + 1] & 0xFF);
|
||||
} else {
|
||||
value = ((byteByffer.array[start + index * 2 + 1] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2] & 0xFF);
|
||||
}
|
||||
return (char)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putChar(int index, char value) {
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
byteByffer.array[start + index * 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)value;
|
||||
} else {
|
||||
byteByffer.array[start + index * 2] = (byte)value;
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)(value >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isArrayPresent() {
|
||||
return false;
|
||||
|
@ -84,9 +51,4 @@ class TCharBufferOverByteBuffer extends TCharBufferImpl {
|
|||
boolean readOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return byteOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TCharBufferOverByteBufferBigEndian extends TCharBufferOverByteBuffer {
|
||||
public TCharBufferOverByteBufferBigEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
char getChar(int index) {
|
||||
int value = ((byteByffer.array[start + index * 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2 + 1] & 0xFF);
|
||||
return (char)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putChar(int index, char value) {
|
||||
byteByffer.array[start + index * 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
TCharBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TCharBufferOverByteBufferBigEndian(this.start + start * 2, capacity, byteByffer,
|
||||
position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.LITTLE_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TCharBufferOverByteBufferLittleEndian extends TCharBufferOverByteBuffer {
|
||||
public TCharBufferOverByteBufferLittleEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
char getChar(int index) {
|
||||
int value = ((byteByffer.array[start + index * 2 + 1] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2] & 0xFF);
|
||||
return (char)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putChar(int index, char value) {
|
||||
byteByffer.array[start + index * 2] = (byte)value;
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)(value >> 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.BIG_ENDIAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
TCharBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TCharBufferOverByteBufferLittleEndian(this.start + start * 2, capacity, byteByffer,
|
||||
position, limit, readOnly);
|
||||
}
|
||||
}
|
|
@ -19,11 +19,10 @@ package org.teavm.classlib.java.nio;
|
|||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TFloatBufferOverByteBuffer extends TFloatBufferImpl {
|
||||
private TByteBufferImpl byteByffer;
|
||||
TByteOrder byteOrder = TByteOrder.BIG_ENDIAN;
|
||||
abstract class TFloatBufferOverByteBuffer extends TFloatBufferImpl {
|
||||
TByteBufferImpl byteByffer;
|
||||
boolean readOnly;
|
||||
private int start;
|
||||
int start;
|
||||
|
||||
public TFloatBufferOverByteBuffer(int start, int capacity, TByteBufferImpl byteBuffer, int position, int limit,
|
||||
boolean readOnly) {
|
||||
|
@ -33,47 +32,6 @@ class TFloatBufferOverByteBuffer extends TFloatBufferImpl {
|
|||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
TFloatBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
TFloatBufferOverByteBuffer result = new TFloatBufferOverByteBuffer(this.start + start * 2, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
result.byteOrder = byteOrder;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
float getElement(int index) {
|
||||
int value;
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
value = ((byteByffer.array[start + index * 4] & 0xFF) << 24) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 4 + 3] & 0xFF);
|
||||
} else {
|
||||
value = (byteByffer.array[start + index * 4] & 0xFF) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 8) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 3] & 0xFF) << 24);
|
||||
}
|
||||
return Float.intBitsToFloat(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, float f) {
|
||||
int value = Float.floatToIntBits(f);
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
byteByffer.array[start + index * 4] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)value;
|
||||
} else {
|
||||
byteByffer.array[start + index * 4] = (byte)value;
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)(value >> 24);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isArrayPresent() {
|
||||
return false;
|
||||
|
@ -93,9 +51,4 @@ class TFloatBufferOverByteBuffer extends TFloatBufferImpl {
|
|||
boolean readOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return byteOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TFloatBufferOverByteBufferBigEndian extends TFloatBufferOverByteBuffer {
|
||||
public TFloatBufferOverByteBufferBigEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TFloatBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TFloatBufferOverByteBufferBigEndian(this.start + start * 4, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
float getElement(int index) {
|
||||
int value = (byteByffer.array[start + index * 4] & 0xFF) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 8) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 3] & 0xFF) << 24);
|
||||
return Float.intBitsToFloat(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, float f) {
|
||||
int value = Float.floatToIntBits(f);
|
||||
byteByffer.array[start + index * 4] = (byte)value;
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)(value >> 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.BIG_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TFloatBufferOverByteBufferLittleEndian extends TFloatBufferOverByteBuffer {
|
||||
public TFloatBufferOverByteBufferLittleEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TFloatBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TFloatBufferOverByteBufferLittleEndian(this.start + start * 4, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
float getElement(int index) {
|
||||
int value = ((byteByffer.array[start + index * 4] & 0xFF) << 24) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 4 + 3] & 0xFF);
|
||||
return Float.intBitsToFloat(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, float f) {
|
||||
int value = Float.floatToIntBits(f);
|
||||
byteByffer.array[start + index * 4] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.LITTLE_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -19,11 +19,10 @@ package org.teavm.classlib.java.nio;
|
|||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public class TIntBufferOverByteBuffer extends TIntBufferImpl {
|
||||
private TByteBufferImpl byteByffer;
|
||||
TByteOrder byteOrder = TByteOrder.BIG_ENDIAN;
|
||||
abstract class TIntBufferOverByteBuffer extends TIntBufferImpl {
|
||||
TByteBufferImpl byteByffer;
|
||||
boolean readOnly;
|
||||
private int start;
|
||||
int start;
|
||||
|
||||
public TIntBufferOverByteBuffer(int start, int capacity, TByteBufferImpl byteBuffer, int position, int limit,
|
||||
boolean readOnly) {
|
||||
|
@ -33,46 +32,6 @@ public class TIntBufferOverByteBuffer extends TIntBufferImpl {
|
|||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
TIntBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
TIntBufferOverByteBuffer result = new TIntBufferOverByteBuffer(this.start + start * 2, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
result.byteOrder = byteOrder;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getElement(int index) {
|
||||
int value;
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
value = ((byteByffer.array[start + index * 4] & 0xFF) << 24) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 4 + 3] & 0xFF);
|
||||
} else {
|
||||
value = (byteByffer.array[start + index * 4] & 0xFF) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 8) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 3] & 0xFF) << 24);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, int value) {
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
byteByffer.array[start + index * 4] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)value;
|
||||
} else {
|
||||
byteByffer.array[start + index * 4] = (byte)value;
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)(value >> 24);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isArrayPresent() {
|
||||
return false;
|
||||
|
@ -92,9 +51,4 @@ public class TIntBufferOverByteBuffer extends TIntBufferImpl {
|
|||
boolean readOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return byteOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TIntBufferOverByteBufferBigEndian extends TIntBufferOverByteBuffer {
|
||||
public TIntBufferOverByteBufferBigEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TIntBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TIntBufferOverByteBufferBigEndian(this.start + start * 4, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
int getElement(int index) {
|
||||
return ((byteByffer.array[start + index * 4] & 0xFF) << 24) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 4 + 3] & 0xFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, int value) {
|
||||
byteByffer.array[start + index * 4] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.BIG_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TIntBufferOverByteBufferLittleEndian extends TIntBufferOverByteBuffer {
|
||||
public TIntBufferOverByteBufferLittleEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TIntBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TIntBufferOverByteBufferLittleEndian(this.start + start * 4, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
int getElement(int index) {
|
||||
return (byteByffer.array[start + index * 4] & 0xFF) |
|
||||
((byteByffer.array[start + index * 4 + 1] & 0xFF) << 8) |
|
||||
((byteByffer.array[start + index * 4 + 2] & 0xFF) << 16) |
|
||||
((byteByffer.array[start + index * 4 + 3] & 0xFF) << 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, int value) {
|
||||
byteByffer.array[start + index * 4] = (byte)value;
|
||||
byteByffer.array[start + index * 4 + 1] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 4 + 2] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 4 + 3] = (byte)(value >> 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.LITTLE_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -19,11 +19,10 @@ package org.teavm.classlib.java.nio;
|
|||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TLongBufferOverByteBuffer extends TLongBufferImpl {
|
||||
private TByteBufferImpl byteByffer;
|
||||
TByteOrder byteOrder = TByteOrder.BIG_ENDIAN;
|
||||
abstract class TLongBufferOverByteBuffer extends TLongBufferImpl {
|
||||
TByteBufferImpl byteByffer;
|
||||
boolean readOnly;
|
||||
private int start;
|
||||
int start;
|
||||
|
||||
public TLongBufferOverByteBuffer(int start, int capacity, TByteBufferImpl byteBuffer, int position, int limit,
|
||||
boolean readOnly) {
|
||||
|
@ -33,62 +32,6 @@ class TLongBufferOverByteBuffer extends TLongBufferImpl {
|
|||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
TLongBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
TLongBufferOverByteBuffer result = new TLongBufferOverByteBuffer(this.start + start * 2, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
result.byteOrder = byteOrder;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
long getElement(int index) {
|
||||
long value;
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
value = (((long)byteByffer.array[start + index * 8] & 0xFF) << 56) |
|
||||
(((long)byteByffer.array[start + index * 8 + 1] & 0xFF) << 48) |
|
||||
(((long)byteByffer.array[start + index * 8 + 2] & 0xFF) << 40) |
|
||||
(((long)byteByffer.array[start + index * 8 + 3] & 0xFF) << 32) |
|
||||
(((long)byteByffer.array[start + index * 8 + 4] & 0xFF) << 24) |
|
||||
(((long)byteByffer.array[start + index * 8 + 5] & 0xFF) << 16) |
|
||||
(((long)byteByffer.array[start + index * 8 + 6] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 8 + 7] & 0xFF);
|
||||
} else {
|
||||
value = (byteByffer.array[start + index * 8] & 0xFF) |
|
||||
(((long)byteByffer.array[start + index * 8 + 1] & 0xFF) << 8) |
|
||||
(((long)byteByffer.array[start + index * 8 + 2] & 0xFF) << 16) |
|
||||
(((long)byteByffer.array[start + index * 8 + 3] & 0xFF) << 24) |
|
||||
(((long)byteByffer.array[start + index * 8 + 4] & 0xFF) << 32) |
|
||||
(((long)byteByffer.array[start + index * 8 + 5] & 0xFF) << 40) |
|
||||
(((long)byteByffer.array[start + index * 8 + 6] & 0xFF) << 48) |
|
||||
(((long)byteByffer.array[start + index * 8 + 7] & 0xFF) << 56);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, long value) {
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
byteByffer.array[start + index * 8] = (byte)(value >> 56);
|
||||
byteByffer.array[start + index * 8 + 1] = (byte)(value >> 48);
|
||||
byteByffer.array[start + index * 8 + 2] = (byte)(value >> 40);
|
||||
byteByffer.array[start + index * 8 + 3] = (byte)(value >> 32);
|
||||
byteByffer.array[start + index * 8 + 4] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 8 + 5] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 8 + 6] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 8 + 7] = (byte)value;
|
||||
} else {
|
||||
byteByffer.array[start + index * 8] = (byte)value;
|
||||
byteByffer.array[start + index * 8 + 1] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 8 + 2] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 8 + 3] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 8 + 4] = (byte)(value >> 32);
|
||||
byteByffer.array[start + index * 8 + 5] = (byte)(value >> 40);
|
||||
byteByffer.array[start + index * 8 + 6] = (byte)(value >> 48);
|
||||
byteByffer.array[start + index * 8 + 7] = (byte)(value >> 56);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isArrayPresent() {
|
||||
return false;
|
||||
|
@ -108,9 +51,4 @@ class TLongBufferOverByteBuffer extends TLongBufferImpl {
|
|||
boolean readOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return byteOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TLongBufferOverByteBufferBigEndian extends TLongBufferOverByteBuffer {
|
||||
public TLongBufferOverByteBufferBigEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TLongBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TLongBufferOverByteBufferBigEndian(this.start + start * 8, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
long getElement(int index) {
|
||||
return (((long)byteByffer.array[start + index * 8] & 0xFF) << 56) |
|
||||
(((long)byteByffer.array[start + index * 8 + 1] & 0xFF) << 48) |
|
||||
(((long)byteByffer.array[start + index * 8 + 2] & 0xFF) << 40) |
|
||||
(((long)byteByffer.array[start + index * 8 + 3] & 0xFF) << 32) |
|
||||
(((long)byteByffer.array[start + index * 8 + 4] & 0xFF) << 24) |
|
||||
(((long)byteByffer.array[start + index * 8 + 5] & 0xFF) << 16) |
|
||||
(((long)byteByffer.array[start + index * 8 + 6] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 8 + 7] & 0xFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, long value) {
|
||||
byteByffer.array[start + index * 8] = (byte)(value >> 56);
|
||||
byteByffer.array[start + index * 8 + 1] = (byte)(value >> 48);
|
||||
byteByffer.array[start + index * 8 + 2] = (byte)(value >> 40);
|
||||
byteByffer.array[start + index * 8 + 3] = (byte)(value >> 32);
|
||||
byteByffer.array[start + index * 8 + 4] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 8 + 5] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 8 + 6] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 8 + 7] = (byte)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.BIG_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TLongBufferOverByteBufferLittleEndian extends TLongBufferOverByteBuffer {
|
||||
public TLongBufferOverByteBufferLittleEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TLongBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TLongBufferOverByteBufferLittleEndian(this.start + start * 8, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
long getElement(int index) {
|
||||
return (byteByffer.array[start + index * 8] & 0xFF) |
|
||||
(((long)byteByffer.array[start + index * 8 + 1] & 0xFF) << 8) |
|
||||
(((long)byteByffer.array[start + index * 8 + 2] & 0xFF) << 16) |
|
||||
(((long)byteByffer.array[start + index * 8 + 3] & 0xFF) << 24) |
|
||||
(((long)byteByffer.array[start + index * 8 + 4] & 0xFF) << 32) |
|
||||
(((long)byteByffer.array[start + index * 8 + 5] & 0xFF) << 40) |
|
||||
(((long)byteByffer.array[start + index * 8 + 6] & 0xFF) << 48) |
|
||||
(((long)byteByffer.array[start + index * 8 + 7] & 0xFF) << 56);
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, long value) {
|
||||
byteByffer.array[start + index * 8] = (byte)value;
|
||||
byteByffer.array[start + index * 8 + 1] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 8 + 2] = (byte)(value >> 16);
|
||||
byteByffer.array[start + index * 8 + 3] = (byte)(value >> 24);
|
||||
byteByffer.array[start + index * 8 + 4] = (byte)(value >> 32);
|
||||
byteByffer.array[start + index * 8 + 5] = (byte)(value >> 40);
|
||||
byteByffer.array[start + index * 8 + 6] = (byte)(value >> 48);
|
||||
byteByffer.array[start + index * 8 + 7] = (byte)(value >> 56);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.LITTLE_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -19,11 +19,10 @@ package org.teavm.classlib.java.nio;
|
|||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TShortBufferOverByteBuffer extends TShortBufferImpl {
|
||||
private TByteBufferImpl byteByffer;
|
||||
TByteOrder byteOrder = TByteOrder.BIG_ENDIAN;
|
||||
abstract class TShortBufferOverByteBuffer extends TShortBufferImpl {
|
||||
TByteBufferImpl byteByffer;
|
||||
boolean readOnly;
|
||||
private int start;
|
||||
int start;
|
||||
|
||||
public TShortBufferOverByteBuffer(int start, int capacity, TByteBufferImpl byteBuffer, int position, int limit,
|
||||
boolean readOnly) {
|
||||
|
@ -33,38 +32,6 @@ class TShortBufferOverByteBuffer extends TShortBufferImpl {
|
|||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
TShortBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
TShortBufferOverByteBuffer result = new TShortBufferOverByteBuffer(this.start + start * 2, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
result.byteOrder = byteOrder;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
short getElement(int index) {
|
||||
int value;
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
value = ((byteByffer.array[start + index * 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2 + 1] & 0xFF);
|
||||
} else {
|
||||
value = ((byteByffer.array[start + index * 2 + 1] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2] & 0xFF);
|
||||
}
|
||||
return (short)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, short value) {
|
||||
if (byteOrder == TByteOrder.BIG_ENDIAN) {
|
||||
byteByffer.array[start + index * 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)value;
|
||||
} else {
|
||||
byteByffer.array[start + index * 2] = (byte)value;
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)(value >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isArrayPresent() {
|
||||
return false;
|
||||
|
@ -84,9 +51,4 @@ class TShortBufferOverByteBuffer extends TShortBufferImpl {
|
|||
boolean readOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return byteOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TShortBufferOverByteBufferBigEndian extends TShortBufferOverByteBuffer {
|
||||
public TShortBufferOverByteBufferBigEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TShortBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TShortBufferOverByteBufferBigEndian(this.start + start * 2, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
short getElement(int index) {
|
||||
int value = ((byteByffer.array[start + index * 2] & 0xFF) << 8) |
|
||||
(byteByffer.array[start + index * 2 + 1] & 0xFF);
|
||||
return (short)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, short value) {
|
||||
byteByffer.array[start + index * 2] = (byte)(value >> 8);
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.BIG_ENDIAN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.nio;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
class TShortBufferOverByteBufferLittleEndian extends TShortBufferOverByteBuffer {
|
||||
public TShortBufferOverByteBufferLittleEndian(int start, int capacity, TByteBufferImpl byteBuffer, int position,
|
||||
int limit, boolean readOnly) {
|
||||
super(start, capacity, byteBuffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
TShortBuffer duplicate(int start, int capacity, int position, int limit, boolean readOnly) {
|
||||
return new TShortBufferOverByteBufferLittleEndian(this.start + start * 2, capacity,
|
||||
byteByffer, position, limit, readOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
short getElement(int index) {
|
||||
int value = (byteByffer.array[start + index * 2] & 0xFF) |
|
||||
((byteByffer.array[start + index * 2 + 1] & 0xFF) << 8);
|
||||
return (short)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
void putElement(int index, short value) {
|
||||
byteByffer.array[start + index * 2] = (byte)value;
|
||||
byteByffer.array[start + index * 2 + 1] = (byte)(value >> 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TByteOrder order() {
|
||||
return TByteOrder.LITTLE_ENDIAN;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user