src/org/jnetpcap/packet/format/JFormatter.java
public void format(JPacket packet, Detail detail) throws IOException {

		if (packet == null) {
			packetNull(packet, detail);
			return;
		}

		packetBefore(packet, detail);

		final int count = packet.getHeaderCount();
		for (int i = 0; i < count; i++) {

			final int id = packet.getHeaderIdByIndex(i);
			if (id == JProtocol.PAYLOAD_ID && displayPayload == false) {
				continue;
			}

			try {
				final JHeader header = headers.getHeader(id);
				final Detail headerDetail =
						(detailsPerHeader[id] == null) ? detail : detailsPerHeader[id];

				packet.getHeaderByIndex(i, header);
				if (header.getLength() == 0) {
					continue;
				}

				format(header, headerDetail);
			} catch (UnregisteredHeaderException e) {
				throw new IllegalStateException(e); // Serious internal error
			}
		}

		packetAfter(packet, detail);
	}
/**
	 * Formats a packet for output.
	 * 
	 * @param packet
	 *          packet to format
	 * @param detail
	 *          detail level
	 * @throws IOException
	 *           any IO errors when sending data to default output device
	 */
Formats a packet for output.

@param packet
packet to format
@param detail
detail level
@throws IOException
any IO errors when sending data to default output device
Formats a packet for output . @param packet packet to format @param detail detail level @throws IOException any IO errors when sending data to default output device
public void format(JPacket packet, Detail detail) throws IOException {
		if (packet == null) {
			packetNull(packet, detail);
			return;
		}
		packetBefore(packet, detail);
		final int count = packet.getHeaderCount();
		for (int i = 0; i < count; i++) {
			final int id = packet.getHeaderIdByIndex(i);
			if (id == JProtocol.PAYLOAD_ID && displayPayload == false) {
				continue;
			}
			try {
				final JHeader header = headers.getHeader(id);
				final Detail headerDetail =
						(detailsPerHeader[id] == null) ? detail : detailsPerHeader[id];
				packet.getHeaderByIndex(i, header);
				if (header.getLength() == 0) {
					continue;
				}
				format(header, headerDetail);
			} catch (UnregisteredHeaderException e) {
				throw new IllegalStateException(e); 
			}
		}
		packetAfter(packet, detail);
	}
public void format ( JPacket packet , Detail detail ) throws IOException { if ( packet == null ) { packetNull ( packet , detail ) ; return ; } packetBefore ( packet , detail ) ; final int count = packet . getHeaderCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final int id = packet . getHeaderIdByIndex ( i ) ; if ( id == JProtocol . PAYLOAD_ID && displayPayload == false ) { continue ; } try { final JHeader header = headers . getHeader ( id ) ; final Detail headerDetail = ( detailsPerHeader [ id ] == null ) ? detail : detailsPerHeader [ id ] ; packet . getHeaderByIndex ( i , header ) ; if ( header . getLength ( ) == 0 ) { continue ; } format ( header , headerDetail ) ; } catch ( UnregisteredHeaderException e ) { throw new IllegalStateException ( e ) ; } } packetAfter ( packet , detail ) ; }
Formats a packet for output.
Formats a packet for output .
// Serious internal error