test_class.file: cache-client/src/test/java/net/runelite/protocol/update/encoders/XorEncoderTest.java
test_class.identifier: XorEncoderTest
test_case.body: @Test
  	public void testEncode() throws Exception
  	{
  		ByteBuf buf = Unpooled.buffer(1);
  		buf.markWriterIndex();
  		buf.writeByte(0xff);
  
  		XorEncoder encoder = new XorEncoder();
  		encoder.setKey((byte) 0x1);
  
  		ByteBuf out = Unpooled.buffer(1);
  		encoder.encode(null, buf, out);
  
  		byte encoded = out.readByte();
  		Assert.assertEquals((Byte) (byte) 0xfe, (Byte) encoded);
  	}
test_case.class_method_signature: XorEncoderTest.testEncode()
test_case.full_signature: @Test public void testEncode()
test_case.identifier: testEncode
test_case.invocations: buffer markWriterIndex writeByte setKey buffer encode readByte assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEncode()
focal_class.declarator: key
focal_class.modifier: private
focal_class.original_string: private byte key;
focal_class.type: byte
focal_class.var_name: key
focal_class.file: cache-client/src/main/java/net/runelite/protocol/update/encoders/XorEncoder.java
focal_class.identifier: XorEncoder
focal_class.class_method_signature: XorEncoder.getKey()
focal_class.full_signature: public byte getKey()
focal_class.identifier: getKey
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: byte
focal_class.signature: byte getKey()
focal_class.class_method_signature: XorEncoder.setKey(byte key)
focal_class.full_signature: public void setKey(byte key)
focal_class.identifier: setKey
focal_class.modifiers: public
focal_class.parameters: (byte key)
focal_class.return: void
focal_class.signature: void setKey(byte key)
focal_class.class_method_signature: XorEncoder.encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_class.full_signature: @Override protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_class.identifier: encode
focal_class.modifiers: @Override protected
focal_class.parameters: (ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_class.return: void
focal_class.signature: void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_class.superclass: extends MessageToByteEncoder<ByteBuf>
focal_method.body: @Override
  	protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception
  	{
  		if (key == 0)
  		{
  			out.writeBytes(msg);
  			return;
  		}
  
  		while (msg.isReadable())
  		{
  			out.writeByte(msg.readByte() ^ key);
  		}
  	}
focal_method.class_method_signature: XorEncoder.encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_method.full_signature: @Override protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_method.identifier: encode
focal_method.invocations: writeBytes isReadable writeByte readByte
focal_method.modifiers: @Override protected
focal_method.parameters: (ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)
focal_method.return: void
focal_method.signature: void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out)