test_class.file: BiliLiveLib/src/test/java/charlie/bililivelib/danmaku/DanmakuPacketTest.java
test_class.identifier: DanmakuPacketTest
test_case.body: @Test
      public void generate() throws Exception {
          DanmakuPacket packet = new DanmakuPacket(DanmakuPacket.Action.HEARTBEAT, "sss");
          byte[] buffer = packet.generate();
          assertArrayEquals(new byte[]{0, 0, 0, 19, 0, 16, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 115, 115, 115}, buffer);
      }
test_case.class_method_signature: DanmakuPacketTest.generate()
test_case.full_signature: @Test public void generate()
test_case.identifier: generate
test_case.invocations: generate assertArrayEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void generate()
focal_class.declarator: DEFAULT_HEADER_LENGTH = 0x10
focal_class.modifier: private static final
focal_class.original_string: private static final short DEFAULT_HEADER_LENGTH = 0x10;
focal_class.type: short
focal_class.var_name: DEFAULT_HEADER_LENGTH
focal_class.declarator: DEFAULT_PROTOCOL_VERSION = 1
focal_class.modifier: private static final
focal_class.original_string: private static final short DEFAULT_PROTOCOL_VERSION = 1;
focal_class.type: short
focal_class.var_name: DEFAULT_PROTOCOL_VERSION
focal_class.declarator: DEFAULT_PARAM = 1
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_PARAM = 1;
focal_class.type: int
focal_class.var_name: DEFAULT_PARAM
focal_class.declarator: DEFAULT_LENGTH = -1
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_LENGTH = -1;
focal_class.type: int
focal_class.var_name: DEFAULT_LENGTH
focal_class.declarator: PACKET_HEADER_SIZE = 16
focal_class.modifier: private static final
focal_class.original_string: private static final int PACKET_HEADER_SIZE = 16;
focal_class.type: int
focal_class.var_name: PACKET_HEADER_SIZE
focal_class.declarator: headerLength = DEFAULT_HEADER_LENGTH
focal_class.modifier: private
focal_class.original_string: private short headerLength = DEFAULT_HEADER_LENGTH;
focal_class.type: short
focal_class.var_name: headerLength
focal_class.declarator: protocolVersion = DEFAULT_PROTOCOL_VERSION
focal_class.modifier: private
focal_class.original_string: private short protocolVersion = DEFAULT_PROTOCOL_VERSION;
focal_class.type: short
focal_class.var_name: protocolVersion
focal_class.declarator: length
focal_class.modifier: private
focal_class.original_string: private int length;
focal_class.type: int
focal_class.var_name: length
focal_class.declarator: action
focal_class.modifier: private
focal_class.original_string: private Action action;
focal_class.type: Action
focal_class.var_name: action
focal_class.declarator: param = DEFAULT_PARAM
focal_class.modifier: private
focal_class.original_string: private int param = DEFAULT_PARAM;
focal_class.type: int
focal_class.var_name: param
focal_class.declarator: body = ""
focal_class.modifier: private
focal_class.original_string: private String body = "";
focal_class.type: String
focal_class.var_name: body
focal_class.file: BiliLiveLib/src/main/java/charlie/bililivelib/danmaku/DanmakuPacket.java
focal_class.identifier: DanmakuPacket
focal_class.class_method_signature: DanmakuPacket.DanmakuPacket(Action action)
focal_class.full_signature: public  DanmakuPacket(Action action)
focal_class.identifier: DanmakuPacket
focal_class.modifiers: public
focal_class.parameters: (Action action)
focal_class.signature:  DanmakuPacket(Action action)
focal_class.class_method_signature: DanmakuPacket.DanmakuPacket(Action action, String body)
focal_class.full_signature: public  DanmakuPacket(Action action, String body)
focal_class.identifier: DanmakuPacket
focal_class.modifiers: public
focal_class.parameters: (Action action, String body)
focal_class.signature:  DanmakuPacket(Action action, String body)
focal_class.class_method_signature: DanmakuPacket.generate()
focal_class.full_signature: public byte[] generate()
focal_class.identifier: generate
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] generate()
focal_class.class_method_signature: DanmakuPacket.writeBigEndian(short data, DataOutputStream stream)
focal_class.full_signature: private void writeBigEndian(short data, DataOutputStream stream)
focal_class.identifier: writeBigEndian
focal_class.modifiers: private
focal_class.parameters: (short data, DataOutputStream stream)
focal_class.return: void
focal_class.signature: void writeBigEndian(short data, DataOutputStream stream)
focal_class.class_method_signature: DanmakuPacket.writeBigEndian(int data, DataOutputStream stream)
focal_class.full_signature: private void writeBigEndian(int data, DataOutputStream stream)
focal_class.identifier: writeBigEndian
focal_class.modifiers: private
focal_class.parameters: (int data, DataOutputStream stream)
focal_class.return: void
focal_class.signature: void writeBigEndian(int data, DataOutputStream stream)
focal_class.class_method_signature: DanmakuPacket.calculateLength(byte[] bytes)
focal_class.full_signature: private void calculateLength(byte[] bytes)
focal_class.identifier: calculateLength
focal_class.modifiers: private
focal_class.parameters: (byte[] bytes)
focal_class.return: void
focal_class.signature: void calculateLength(byte[] bytes)
focal_method.body: public byte[] generate() {
          byte[] bodyBytes = body.getBytes(UTF8);
  
          calculateLength(bodyBytes);
  
          ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(length);
          DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
          writeBigEndian(length, dataOutputStream);
          writeBigEndian(headerLength, dataOutputStream);
          writeBigEndian(protocolVersion, dataOutputStream);
          writeBigEndian(action.getID(), dataOutputStream);
          writeBigEndian(param, dataOutputStream);
          if (bodyBytes.length > 0) {
              byteArrayOutputStream.write(bodyBytes, 0, bodyBytes.length);
          }
  
          return byteArrayOutputStream.toByteArray();
      }
focal_method.class_method_signature: DanmakuPacket.generate()
focal_method.full_signature: public byte[] generate()
focal_method.identifier: generate
focal_method.invocations: getBytes calculateLength writeBigEndian writeBigEndian writeBigEndian writeBigEndian getID writeBigEndian write toByteArray
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: byte[]
focal_method.signature: byte[] generate()