Пример #1
0
  public static File getFile(ActionContext actionContext) throws OgnlException {
    Thing self = (Thing) actionContext.get("self");

    Object obj = UtilData.getData(self, "file", actionContext);
    if (obj instanceof File) {
      return (File) obj;
    } else if (obj instanceof String) {
      return new File((String) obj);
    } else {
      throw new ActionException(obj + "is not a file, path=" + self.getMetadata().getPath());
    }
  }
Пример #2
0
 /**
  * size是byte的长度,返回可读的字符串,比如1KB,2MB等。
  *
  * @param size
  * @return
  */
 public static String getSizeInfo(long size) {
   return org.xmeta.util.UtilData.getSizeInfo(size);
 }