List of usage examples for io.netty.buffer ByteBufAllocator DEFAULT
ByteBufAllocator DEFAULT
To view the source code for io.netty.buffer ByteBufAllocator DEFAULT.
Click Source Link
From source file:org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodecTest.java
License:Open Source License
@Before public void setUp() { tunIpv4DstCodec = new TunIpv4DstCodec(); buffer = ByteBufAllocator.DEFAULT.buffer(); }
From source file:org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodecTest.java
License:Open Source License
@Before public void setUp() { tunIpv4SrcCodec = new TunIpv4SrcCodec(); buffer = ByteBufAllocator.DEFAULT.buffer(); }
From source file:org.opendaylight.openflowjava.nx.codec.match.UdpDstCodecTest.java
License:Open Source License
@Before public void setUp() { udpDstCodec = new UdpDstCodec(); buffer = ByteBufAllocator.DEFAULT.buffer(); }
From source file:org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodecTest.java
License:Open Source License
@Before public void setUp() { udpSrcCodec = new UdpSrcCodec(); buffer = ByteBufAllocator.DEFAULT.buffer(); }
From source file:org.springframework.cloud.gateway.rsocket.support.Metadata.java
License:Apache License
public static ByteBuf encode(Metadata metadata) { return encode(ByteBufAllocator.DEFAULT, metadata); }
From source file:org.springframework.cloud.gateway.rsocket.support.Metadata.java
License:Apache License
public static ByteBuf encode(String name, Map<String, String> properties) { return encode(ByteBufAllocator.DEFAULT, name, properties); }
From source file:org.springframework.messaging.rsocket.DefaultRSocketRequesterBuilderTests.java
License:Apache License
@Test public void frameDecoderMatchesDataBufferFactory() throws Exception { testFrameDecoder(new NettyDataBufferFactory(ByteBufAllocator.DEFAULT), PayloadDecoder.ZERO_COPY); testFrameDecoder(new DefaultDataBufferFactory(), PayloadDecoder.DEFAULT); }
From source file:org.springframework.messaging.rsocket.MetadataEncoder.java
License:Apache License
MetadataEncoder(MimeType metadataMimeType, RSocketStrategies strategies) { Assert.notNull(metadataMimeType, "'metadataMimeType' is required"); Assert.notNull(strategies, "RSocketStrategies is required"); this.metadataMimeType = metadataMimeType; this.strategies = strategies; this.isComposite = this.metadataMimeType.toString() .equals(WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA.getString()); this.allocator = bufferFactory() instanceof NettyDataBufferFactory ? ((NettyDataBufferFactory) bufferFactory()).getByteBufAllocator() : ByteBufAllocator.DEFAULT; }
From source file:org.springframework.messaging.rsocket.MetadataEncoderTests.java
License:Apache License
@Test public void defaultDataBufferFactory() { DefaultDataBufferFactory bufferFactory = new DefaultDataBufferFactory(); RSocketStrategies strategies = RSocketStrategies.builder().dataBufferFactory(bufferFactory).build(); DataBuffer buffer = new MetadataEncoder(COMPOSITE_METADATA, strategies).route("toA").encode(); ByteBuf byteBuf = new NettyDataBufferFactory(ByteBufAllocator.DEFAULT).wrap(buffer.asByteBuffer()) .getNativeBuffer();// w w w. j av a2s .c o m CompositeMetadata entries = new CompositeMetadata(byteBuf, false); Iterator<CompositeMetadata.Entry> iterator = entries.iterator(); assertThat(iterator.hasNext()).isTrue(); CompositeMetadata.Entry entry = iterator.next(); assertThat(entry.getMimeType()).isEqualTo(WellKnownMimeType.MESSAGE_RSOCKET_ROUTING.getString()); assertRoute("toA", entry.getContent()); assertThat(iterator.hasNext()).isFalse(); }
From source file:org.waarp.ftp.core.data.handler.FtpDataModeCodec.java
License:Open Source License
protected DataBlock decodeRecordStandard(ByteBuf buf, int length) { ByteBuf newbuf = ByteBufAllocator.DEFAULT.buffer(length); if (lastbyte == 0xFF) { int nextbyte = buf.readByte(); if (nextbyte == 0xFF) { newbuf.writeByte((byte) (lastbyte & 0xFF)); } else {/*from w w w .ja v a 2s .c om*/ if (nextbyte == 1) { dataBlock.setEOR(true); } else if (nextbyte == 2) { dataBlock.setEOF(true); } else if (nextbyte == 3) { dataBlock.setEOR(true); dataBlock.setEOF(true); } lastbyte = 0; } } try { while (true) { lastbyte = buf.readByte(); if (lastbyte == 0xFF) { int nextbyte = buf.readByte(); if (nextbyte == 0xFF) { newbuf.writeByte((byte) (lastbyte & 0xFF)); } else { if (nextbyte == 1) { dataBlock.setEOR(true); } else if (nextbyte == 2) { dataBlock.setEOF(true); } else if (nextbyte == 3) { dataBlock.setEOR(true); dataBlock.setEOF(true); } } } else { newbuf.writeByte((byte) (lastbyte & 0xFF)); } lastbyte = 0; } } catch (IndexOutOfBoundsException e) { // End of read } dataBlock.setBlock(newbuf); return dataBlock; }