1 16 package org.apache.axis.types; 17 18 19 import org.apache.axis.utils.Messages; 20 21 27 public class UnsignedByte extends UnsignedShort { 28 29 30 public UnsignedByte() { 31 32 } 33 34 38 public UnsignedByte(long sValue) throws NumberFormatException { 39 setValue(sValue); 40 } 41 42 public UnsignedByte(String sValue) throws NumberFormatException { 43 setValue(Long.parseLong(sValue)); 44 } 45 46 52 public void setValue(long sValue) throws NumberFormatException { 53 if (UnsignedByte.isValid(sValue) == false) 54 throw new NumberFormatException ( 55 Messages.getMessage("badUnsignedByte00") + 56 String.valueOf(sValue) + "]"); 57 lValue = new Long (sValue); 58 } 59 60 65 public static boolean isValid(long sValue) { 66 if ( (sValue < 0L ) || (sValue > 255L) ) 67 return false; 68 else 69 return true; 70 } 71 72 } 73 | Popular Tags |