Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.array()


    {
      AELog.error( t );
    }

    stream.capacity( stream.readableBytes() );
    data.setByteArray( "X", stream.array() );
    return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data );
  }

  @Override
  public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
View Full Code Here


    if ( writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
      throw new BufferOverflowException();
    else
    {
      writtenBytes += tmp.readableBytes();
      compressFrame.write( tmp.array(), 0, tmp.readableBytes() );
      empty = false;
    }
  }

  public int getLength()
View Full Code Here

    {
        int readableBytes = in.readableBytes();
        byte[] heapIn = bufToByte( in );

        ByteBuf heapOut = ctx.alloc().heapBuffer( cipher.getOutputSize( readableBytes ) );
        heapOut.writerIndex( cipher.update( heapIn, 0, readableBytes, heapOut.array(), heapOut.arrayOffset() ) );

        return heapOut;
    }

    @Override
View Full Code Here

                user.unsafe().sendPacket( new PluginMessage( "MC|Brand", out.toArray(), handshakeHandler.isServerForge() ) );
            } else
            {
                ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer();
                DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")", brand );
                user.unsafe().sendPacket( new PluginMessage( "MC|Brand", brand.array().clone(), handshakeHandler.isServerForge() ) );
                brand.release();
            }
        } else
        {
            user.getTabListHandler().onServerChange();
View Full Code Here

                    ByteBuf brand = Unpooled.wrappedBuffer( pluginMessage.getData() );
                    String serverBrand = DefinedPacket.readString( brand );
                    brand.release();
                    brand = ByteBufAllocator.DEFAULT.heapBuffer();
                    DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand );
                    pluginMessage.setData( brand.array().clone() );
                    brand.release();
                } catch ( Exception ignored ) {
                    // TODO: Remove this
                    // Older spigot protocol builds sent the brand incorrectly
                    return;
View Full Code Here

    buf.writeInt(128);
    buf.writeInt(255);
    buf.writeInt(256);
    buf.writeInt(Integer.MAX_VALUE)// 2147483647
   
    byte[] bytes = buf.array();
    writeToFile(bytes);
  }
 
  @Ignore
  @Test
View Full Code Here

    buf.writeLong(128);
    buf.writeLong(255);
    buf.writeLong(256);
    buf.writeLong(Long.MAX_VALUE)// 923372036854775807
   
    byte[] bytes = buf.array();
    writeToFile(bytes);
  }

  @Ignore
  @Test
View Full Code Here

    for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) // -128 ... 127
    {
      buf.writeByte(i);     
    }
   
    byte[] bytes = buf.array();
    writeToFile(bytes);
  }
 
  @Ignore
  @Test
View Full Code Here

      byteArray[i] = (byte)b;
    }
   
    buf.writeBytes(byteArray);
   
    byte[] bytes = buf.array();
    writeToFile(bytes);
  }
 
  @Ignore
  @Test
View Full Code Here

            // Validate stored data.
            ByteBuf buffer = data.getByteBuf();

            assertEquals(0, buffer.readerIndex());
            assertEquals(bytes.length, buffer.writerIndex());
            assertArrayEquals(bytes, Arrays.copyOf(buffer.array(), bytes.length));
        }
    }

    /** Memory-based HTTP data implementation for test purposes. */
    private static final class TestHttpData extends AbstractMemoryHttpData {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.