Example usage for java.awt.image RasterFormatException RasterFormatException

List of usage examples for java.awt.image RasterFormatException RasterFormatException

Introduction

In this page you can find the example usage for java.awt.image RasterFormatException RasterFormatException.

Prototype

public RasterFormatException(String s) 

Source Link

Document

Constructs a new RasterFormatException with the specified message.

Usage

From source file:BlendCompositeDemo.java

/**
 * {@inheritDoc}/*from   w  ww.j  a  v  a2s .co  m*/
 */
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel,
        RenderingHints hints) {
    if (!checkComponentsOrder(srcColorModel) || !checkComponentsOrder(dstColorModel)) {
        throw new RasterFormatException("Incompatible color models");
    }

    return new BlendingContext(this);
}

From source file:org.gaixie.micrite.common.search.SearchFactory.java

@SuppressWarnings("unchecked")
private static Object convertValue(Class type, String value, String relation) {
    Object object;/*from w  w  w.j  a v  a2  s  .com*/
    if (relation.equals("between")) {
        List list = new ArrayList();
        String[] betValue = StringUtils.split(value, ';');
        if (type == java.util.Date.class) {
            if (betValue[0].length() == 10)
                betValue[0] += " 00:00:00";
            else
                betValue[0] += ":00";
            if (betValue[1].length() == 10)
                betValue[1] += " 23:59:59";
            else
                betValue[1] += ":59";
            try {
                list.add(DateUtils.parseDate(betValue[0], new String[] { "yyyy-MM-dd hh:mm:ss" }));
                list.add(DateUtils.parseDate(betValue[1], new String[] { "yyyy-MM-dd hh:mm:ss" }));
            } catch (Exception e) {
                throw new RasterFormatException("??");
            }
        } else {
            list.add(OgnlOps.convertValue(betValue[0], type));
            list.add(OgnlOps.convertValue(betValue[1], type));
        }
        object = list;
    } else if (relation.equals("in")) {
        List list = new ArrayList();
        for (String s : StringUtils.split(value, ';')) {
            list.add(OgnlOps.convertValue(s, type));
        }
        object = list;
    } else if (relation.equals("like")) {
        object = OgnlOps.convertValue("%" + value + "%", type);
    } else {
        if (type == java.util.Date.class) {
            if (relation.equals("<") || relation.equals("<=")) {
                if (value.length() == 10)
                    value += " 23:59:59";
                else
                    value += ":59";
            } else {
                if (value.length() == 10)
                    value += " 00:00:00";
                else
                    value += ":00";
            }
            try {
                object = DateUtils.parseDate(value, new String[] { "yyyy-MM-dd hh:mm:ss" });
            } catch (ParseException e) {
                throw new RasterFormatException("??");
            }
        } else
            object = OgnlOps.convertValue(value, type);
    }
    return object;
}

From source file:org.gaixie.micrite.common.search.SearchFactory.java

private static String[] detach(String str, char left, char right) {
    String string = str;//from w  ww .j  a  va 2s. c  o m
    if (string == null || string.equals(""))
        return null;
    List<String> list = new ArrayList<String>();
    if (StringUtils.indexOf(string, left) == -1 || StringUtils.indexOf(string, right) == -1)
        throw new RasterFormatException("??: " + string);
    while (StringUtils.indexOf(string, left) >= 0 && StringUtils.indexOf(string, right) >= 0) {
        int il = StringUtils.indexOf(string, left);
        int ir = StringUtils.indexOf(string, right);
        if (il > ir) {
            string = StringUtils.substring(string, right + 1);
            continue;
        }
        list.add(StringUtils.substring(string, il + 1, ir));
        string = StringUtils.substring(string, ir + 1);
    }
    return list.toArray(new String[list.size()]);
}