io.netty.buffer.SwappedByteBuf Java Examples

The following examples show how to use io.netty.buffer.SwappedByteBuf. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwappedByteBufBenchmark.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Setup
public void setup() {
    swappedByteBuf = new SwappedByteBuf(Unpooled.directBuffer(8));
    unsafeSwappedByteBuf = Unpooled.directBuffer(8).order(ByteOrder.LITTLE_ENDIAN);
    if (unsafeSwappedByteBuf.getClass().equals(SwappedByteBuf.class)) {
        throw new IllegalStateException("Should not use " + SwappedByteBuf.class.getSimpleName());
    }
}
 
Example #2
Source File: ReplayingDecoderByteBuf.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public ByteBuf order(ByteOrder endianness) {
    if (endianness == null) {
        throw new NullPointerException("endianness");
    }
    if (endianness == order()) {
        return this;
    }

    SwappedByteBuf swapped = this.swapped;
    if (swapped == null) {
        this.swapped = swapped = new SwappedByteBuf(this);
    }
    return swapped;
}
 
Example #3
Source File: SwappedByteBufBenchmark.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Setup
public void setup() {
    swappedByteBuf = new SwappedByteBuf(Unpooled.directBuffer(8));
    unsafeSwappedByteBuf = Unpooled.directBuffer(8).order(ByteOrder.LITTLE_ENDIAN);
    if (unsafeSwappedByteBuf.getClass().equals(SwappedByteBuf.class)) {
        throw new IllegalStateException("Should not use " + SwappedByteBuf.class.getSimpleName());
    }
}
 
Example #4
Source File: ReplayingDecoderBuffer.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Override
public ByteBuf order(ByteOrder endianness) {
    if (endianness == null) {
        throw new NullPointerException("endianness");
    }
    if (endianness == order()) {
        return this;
    }

    SwappedByteBuf swapped = this.swapped;
    if (swapped == null) {
        this.swapped = swapped = new SwappedByteBuf(this);
    }
    return swapped;
}
 
Example #5
Source File: ReplayingDecoderBuffer.java    From ProtocolSupportBungee with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public ByteBuf order(final ByteOrder byteOrder) {
	if (byteOrder == null) {
		throw new NullPointerException("endianness");
	}
	if (byteOrder == this.order()) {
		return this;
	}
	SwappedByteBuf swapped = this.swapped;
	if (swapped == null) {
		swapped = (this.swapped = new SwappedByteBuf(this));
	}
	return swapped;
}
 
Example #6
Source File: ReplayingDecoderBuffer.java    From ProtocolSupport with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public ByteBuf order(final ByteOrder byteOrder) {
	if (byteOrder == null) {
		throw new NullPointerException("endianness");
	}
	if (byteOrder == this.order()) {
		return this;
	}
	SwappedByteBuf swapped = this.swapped;
	if (swapped == null) {
		swapped = (this.swapped = new SwappedByteBuf(this));
	}
	return swapped;
}