public String encodeBandwidth(Bandwidth bandwidth) { StringBuffer s = new StringBuffer(""); if (bandwidth.getBandwidthLowerBound() != bandwidth.getBandwidthUpperBound()) { s.append(bandwidth.getBandwidthLowerBound()).append("-").append(bandwidth.getBandwidthUpperBound()); } else { s.append(bandwidth.getBandwidthLowerBound()); } return s.toString(); }
public static int encode(byte[] destination,int offset,Bandwidth bandwidth) { int usedLength=StringFunctions.encodeInt(destination,offset,bandwidth.getBandwidthLowerBound()); if(bandwidth.getBandwidthLowerBound()!=bandwidth.getBandwidthUpperBound()) { destination[offset+usedLength]=StringFunctions.MINUS_BYTE; usedLength++; usedLength+=StringFunctions.encodeInt(destination,offset+usedLength,bandwidth.getBandwidthUpperBound()); } return usedLength; } }
public static int encode(byte[] destination,int offset,Bandwidth bandwidth) { int usedLength=StringFunctions.encodeInt(destination,offset,bandwidth.getBandwidthLowerBound()); if(bandwidth.getBandwidthLowerBound()!=bandwidth.getBandwidthUpperBound()) { destination[offset+usedLength]=StringFunctions.MINUS_BYTE; usedLength++; usedLength+=StringFunctions.encodeInt(destination,offset+usedLength,bandwidth.getBandwidthUpperBound()); } return usedLength; } }