/** * Start time:13:05:28 2009-04-05<br> * Project: mobicents-isup-stack<br> * * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski * </a> * */ package org.mobicents.ss7.isup.impl.message.parameter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import org.mobicents.ss7.isup.ParameterRangeInvalidException; import org.mobicents.ss7.isup.message.parameter.CalledNumber; /** * Start time:13:05:28 2009-04-05<br> * Project: mobicents-isup-stack<br> * * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski * </a> * */ public abstract class CalledNumberImpl extends AbstractNAINumber implements CalledNumber{ protected int numberingPlanIndicator; protected int addressRepresentationRestrictedIndicator; public CalledNumberImpl(byte[] representation) throws ParameterRangeInvalidException { super(representation); // TODO Auto-generated constructor stub } public CalledNumberImpl() throws ParameterRangeInvalidException { super(); // TODO Auto-generated constructor stub } public CalledNumberImpl(ByteArrayInputStream bis) throws ParameterRangeInvalidException { super(bis); // TODO Auto-generated constructor stub } public CalledNumberImpl(int natureOfAddresIndicator, String address, int numberingPlanIndicator, int addressRepresentationREstrictedIndicator) { super(natureOfAddresIndicator, address); this.numberingPlanIndicator = numberingPlanIndicator; this.addressRepresentationRestrictedIndicator = addressRepresentationREstrictedIndicator; } /* * (non-Javadoc) * * @seeorg.mobicents.isup.parameters.AbstractNumber#decodeBody(java.io. * ByteArrayInputStream) */ @Override public int decodeBody(ByteArrayInputStream bis) throws IllegalArgumentException { int b = bis.read() & 0xff; this.numberingPlanIndicator = (b & 0x70) >> 4; this.addressRepresentationRestrictedIndicator = (b & 0x0c) >> 2; return 1; } /* * (non-Javadoc) * * @seeorg.mobicents.isup.parameters.AbstractNumber#encodeBody(java.io. * ByteArrayOutputStream) */ @Override public int encodeBody(ByteArrayOutputStream bos) { int c = (this.numberingPlanIndicator & 0x07) << 4; c |= ((this.addressRepresentationRestrictedIndicator & 0x03) << 2); bos.write(c); return 1; } public int getNumberingPlanIndicator() { return numberingPlanIndicator; } public void setNumberingPlanIndicator(int numberingPlanIndicator) { this.numberingPlanIndicator = numberingPlanIndicator; } public int getAddressRepresentationRestrictedIndicator() { return addressRepresentationRestrictedIndicator; } public void setAddressRepresentationRestrictedIndicator(int addressRepresentationREstrictedIndicator) { this.addressRepresentationRestrictedIndicator = addressRepresentationREstrictedIndicator; } }