Ejemplo n.º 1
0
 protected byte[] packFrameData() {
   byte[] bytes = new byte[getLength()];
   if (description != null) bytes[0] = description.getTextEncoding();
   else bytes[0] = 0;
   int mimeTypeLength = 0;
   if (mimeType != null && mimeType.length() > 0) {
     mimeTypeLength = mimeType.length();
     BufferTools.stringIntoByteBuffer(mimeType, 0, mimeTypeLength, bytes, 1);
   }
   bytes[mimeTypeLength + 1] = 0;
   bytes[mimeTypeLength + 2] = pictureType;
   int descriptionLength = 0;
   if (description != null && description.toBytes().length > 0) {
     descriptionLength = description.toBytes().length;
     BufferTools.copyIntoByteBuffer(
         description.toBytes(), 0, descriptionLength, bytes, mimeTypeLength + 3);
   }
   bytes[mimeTypeLength + descriptionLength + 3] = 0;
   if (imageData != null && imageData.length > 0) {
     BufferTools.copyIntoByteBuffer(
         imageData, 0, imageData.length, bytes, mimeTypeLength + descriptionLength + 4);
   }
   return bytes;
 }