use of com.zx.sms.codec.smpp.NotEnoughDataInBufferException in project SMSGate by Lihuanghe.
the class ByteBufUtil method readAddress.
/**
* Read and create a new Address from a buffer. Checks if there is
* a minimum number of bytes readable from the buffer.
* @param buffer
* @return
* @throws UnrecoverablePduException
* @throws RecoverablePduException
*/
public static Address readAddress(ByteBuf buffer) throws UnrecoverablePduException, RecoverablePduException {
// an address is at least 3 bytes long (ton, npi, and null byte)
if (buffer.readableBytes() < 3) {
throw new NotEnoughDataInBufferException("Parsing address", buffer.readableBytes(), 3);
}
Address address = new Address();
address.read(buffer);
return address;
}
Aggregations