Package org.raist.common.codec

Examples of org.raist.common.codec.CodingException


    if( dest == null || dest.isEmpty() )
      return null;

    E result = map.get(dest);
    if( result == null )
      throw new CodingException(type.getSimpleName() + " not found: " + dest);

    return result;
  }
View Full Code Here


    if (val.equalsIgnoreCase("true"))
      return Boolean.TRUE;
    else if (val.equalsIgnoreCase("false"))
      return Boolean.FALSE;
    else
      throw new CodingException("Invalid boolean value expression: " + val);
  }
View Full Code Here

  public char decodeChar(String val) {

    if (val.length() == 1)
      return val.charAt(0);
    else
      throw new CodingException("Invalid char value expression: " + val);
  }
View Full Code Here

      return Integer.parseInt(val);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

      return Long.parseLong(val);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

      return Float.parseFloat(val);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

      return Double.parseDouble(val);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

      int rgba = Integer.parseInt(val, 16);
      return new Color(rgba);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

    if (val == null)
      return null;

    String[] tokens = val.split(ConsText.DilimDimension.v);
    if (tokens.length != 2)
      throw new CodingException("Invalid String representation for dimension.");

    try {

      int width = Integer.parseInt(tokens[0]);
      int height = Integer.parseInt(tokens[1]);

      return new Dimension(width, height);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

    if (val == null)
      return null;

    String[] tokens = val.split(ConsText.DilimPoint.v);
    if (tokens.length != 2)
      throw new CodingException("Invalid string representation of a Point value: " + val);

    try {

      int x = Integer.parseInt(tokens[0]);
      int y = Integer.parseInt(tokens[1]);
      return new Point(x, y);
    }
    catch (NumberFormatException ex) {

      throw new CodingException(ex.getMessage(), ex);
    }
  }
View Full Code Here

TOP

Related Classes of org.raist.common.codec.CodingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.