/** * Internal function to format the bundle flags so they can be stored in one byte. * * @param bundle Bundle to get the flags values * @return Formatted value of the flags */ protected static int format_bundle_flags(final Bundle bundle) { int flags = 0; if (bundle.is_fragment()) { flags |= bundle_processing_flag_t.BUNDLE_IS_FRAGMENT.getCode(); } if (bundle.is_admin()) { flags |= bundle_processing_flag_t.BUNDLE_IS_ADMIN.getCode(); } if (bundle.do_not_fragment()) { flags |= bundle_processing_flag_t.BUNDLE_DO_NOT_FRAGMENT.getCode(); } if (bundle.custody_requested()) { flags |= bundle_processing_flag_t.BUNDLE_CUSTODY_XFER_REQUESTED.getCode(); } if (bundle.singleton_dest()) { flags |= bundle_processing_flag_t.BUNDLE_SINGLETON_DESTINATION.getCode(); } if (bundle.app_acked_rcpt()) { flags |= bundle_processing_flag_t.BUNDLE_ACK_BY_APP.getCode(); } return flags; }
/** * Function to parse the formatted value of the flags * * @param bundle Bundle to set the flag values * @param flags Formatted value of flags */ public static void parse_bundle_flags(Bundle bundle, long flags) { if ((flags & bundle_processing_flag_t.BUNDLE_IS_FRAGMENT.getCode()) > 0) { bundle.set_is_fragment(true); } else { bundle.set_is_fragment(false); } if ((flags & bundle_processing_flag_t.BUNDLE_IS_ADMIN.getCode()) > 0) { bundle.set_is_admin(true); } else { bundle.set_is_admin(false); } if ((flags & bundle_processing_flag_t.BUNDLE_DO_NOT_FRAGMENT.getCode()) > 0) { bundle.set_do_not_fragment(true); } else { bundle.set_do_not_fragment(false); } if ((flags & bundle_processing_flag_t.BUNDLE_CUSTODY_XFER_REQUESTED.getCode()) > 0) { bundle.set_custody_requested(true); } else { bundle.set_custody_requested(false); } if ((flags & bundle_processing_flag_t.BUNDLE_SINGLETON_DESTINATION.getCode()) > 0) { bundle.set_singleton_dest(true); } else { bundle.set_singleton_dest(false); } if ((flags & bundle_processing_flag_t.BUNDLE_ACK_BY_APP.getCode()) > 0) { bundle.set_app_acked_rcpt(true); } else { bundle.set_app_acked_rcpt(false); } }