Package org.onlab.packet
Class PacketUtils
- java.lang.Object
- 
- org.onlab.packet.PacketUtils
 
- 
 public final class PacketUtils extends java.lang.ObjectUtilities for working with packet headers.
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckBufferLength(int byteLength, int offset, int length)Check the length of the input buffer is appropriate given the offset and length parameters.static voidcheckHeaderLength(int givenLength, int requiredLength)Check that there are enough bytes in the buffer to read some number of bytes that we need to read a full header.static voidcheckInput(byte[] data, int offset, int length, int requiredLength)Check the input parameters are sane and there's enough bytes to read the required length.
 
- 
- 
- 
Method Detail- 
checkBufferLengthpublic static void checkBufferLength(int byteLength, int offset, int length) throws DeserializationExceptionCheck the length of the input buffer is appropriate given the offset and length parameters.- Parameters:
- byteLength- length of the input buffer array
- offset- offset given to begin reading bytes from
- length- length given to read up until
- Throws:
- DeserializationException- if the input parameters don't match up (i.e we can't read that many bytes from the buffer at the given offest)
 
 - 
checkHeaderLengthpublic static void checkHeaderLength(int givenLength, int requiredLength) throws DeserializationExceptionCheck that there are enough bytes in the buffer to read some number of bytes that we need to read a full header.- Parameters:
- givenLength- given size of the buffer
- requiredLength- number of bytes we need to read some header fully
- Throws:
- DeserializationException- if there aren't enough bytes
 
 - 
checkInputpublic static void checkInput(byte[] data, int offset, int length, int requiredLength) throws DeserializationExceptionCheck the input parameters are sane and there's enough bytes to read the required length.- Parameters:
- data- input byte buffer
- offset- offset of the start of the header
- length- length given to deserialize the header
- requiredLength- length needed to deserialize header
- Throws:
- DeserializationException- if we're unable to deserialize the packet based on the input parameters
 
 
- 
 
-