public static SObject getInvalidObject(String key, Throwable cause) { SObject sobj = of(key, ""); sobj.valid = false; sobj.cause = cause; return sobj; }
@Override public ISObject getLazy(String key, Map<String, String> attrs) { SObject sobj = SObject.lazyLoad(key, this); sobj.setAttributes(attrs); return sobj; }
@Override public boolean isEmpty() { String s = asString(); return null == s || "".equals(s); }
/** * Construct an SObject with random generated key, byte array and number of bytes * @param buf the source byte array * @param len the number of bytes in the array should be stored in the returing object * @return an SObject as described above */ public static SObject of(byte[] buf, int len) { return of(randomKey(), buf, len); }
/** * Construct an sobject with content, key and attributes specified in * {@link Map} */ public static SObject of(String key, String content, Map<String, String> attrs) { SObject sobj = of(key, content); sobj.setAttributes(attrs); return sobj; }
@Override public void consumeOnce($.Function<InputStream, ?> consumer) { InputStream is = null; try { is = asInputStream(); consumer.apply(is); } finally { IO.close(is); } }
@Override public String getContentType() { return getAttribute(ATTR_CONTENT_TYPE); }
/** * Construct an sobject with content, key and attributes specified in * {@link Map} */ public static SObject of(String key, String content, Map<String, String> attrs) { SObject sobj = of(key, content); sobj.setAttributes(attrs); return sobj; }
/** * Construct an SObject with random generated key, byte array and number of bytes * @param buf the source byte array * @param len the number of bytes in the array should be stored in the returing object * @return an SObject as described above */ public static SObject of(byte[] buf, int len) { return of(randomKey(), buf, len); }
@Override public void consumeOnce($.Function<InputStream, ?> consumer) { InputStream is = null; try { is = asInputStream(); consumer.apply(is); } finally { IO.close(is); } }
@Override public String getFilename() { return getAttribute(ATTR_FILE_NAME); }
public static SObject getInvalidObject(String key, Throwable cause) { SObject sobj = of(key, ""); sobj.valid = false; sobj.cause = cause; return sobj; }
/** * Construct a sobject with key, input stream and attributes specified in a * {@link Map}. * <p> * <p>Node the sobject constrcuted from input stream has limits * please see the comment to {@link #of(String, InputStream)} * </p> * * @see #of(String, InputStream) */ public static SObject of(String key, InputStream is, Map<String, String> conf) { SObject sobj = of(key, is); sobj.setAttributes(conf); return sobj; }
public static SObject lazyLoad(String key, IStorageService ss, Map<String, String> conf) { SObject sobj = lazyLoad(key, ss); sobj.setAttributes(conf); return sobj; }
List<String> lines = IO.readLines(sobj.asInputStream(), end); int len = lines.size(); context.println("");