本文整理汇总了Java中org.osgl.storage.ISObject类的典型用法代码示例。如果您正苦于以下问题:Java ISObject类的具体用法?Java ISObject怎么用?Java ISObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISObject类属于org.osgl.storage包,在下文中一共展示了ISObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeBinary
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public UndertowResponse writeBinary(ISObject binary) {
beforeWritingContent();
File file = tryGetFileFrom(binary);
if (null == file) {
byte[] ba = binary.asByteArray();
ByteBuffer buffer = ByteBuffer.wrap(ba);
hse.getResponseSender().send(buffer);
} else {
try {
hse.getResponseSender().transferFrom(FileChannel.open(file.toPath()), IoCallback.END_EXCHANGE);
endAsync = true;
} catch (IOException e) {
endAsync = false;
throw E.ioException(e);
}
}
afterWritingContent();
return this;
}
开发者ID:actframework,项目名称:actframework,代码行数:21,代码来源:UndertowResponse.java
示例2: _store
import org.osgl.storage.ISObject; //导入依赖的package包/类
private ISObject _store(FileItemStream fileItemStream) throws IOException {
String filename = fileItemStream.getName();
String key = newKey(filename);
File tmpFile = getFile(key);
InputStream input = fileItemStream.openStream();
ThresholdingByteArrayOutputStream output = new ThresholdingByteArrayOutputStream(inMemoryCacheThreshold, tmpFile);
IO.copy(input, output);
ISObject retVal;
if (output.exceedThreshold) {
retVal = getFull(key);
} else {
int size = output.written;
byte[] buf = output.buf();
retVal = SObject.of(key, buf, size);
}
if (S.notBlank(filename)) {
retVal.setFilename(filename);
}
String contentType = fileItemStream.getContentType();
if (null != contentType) {
retVal.setContentType(contentType);
}
return retVal;
}
开发者ID:actframework,项目名称:actframework,代码行数:27,代码来源:UploadFileStorageService.java
示例3: zip
import org.osgl.storage.ISObject; //导入依赖的package包/类
public static ISObject zip(ISObject... objects) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
try {
for (ISObject obj: objects) {
ZipEntry entry = new ZipEntry(obj.getAttribute(SObject.ATTR_FILE_NAME));
InputStream is = obj.asInputStream();
zos.putNextEntry(entry);
copy(is, zos, false);
zos.closeEntry();
}
} catch (IOException e) {
throw E.ioException(e);
} finally {
close(zos);
}
return SObject.of(Codec.encodeUrl(S.random()), baos.toByteArray());
}
开发者ID:osglworks,项目名称:java-tool,代码行数:19,代码来源:IO.java
示例4: delete
import org.osgl.storage.ISObject; //导入依赖的package包/类
public void delete(ISObject sobj) {
String id = sobj.getAttribute(ISObject.ATTR_SS_ID);
IStorageService ss = storageService(id);
String contextPath = sobj.getAttribute(ISObject.ATTR_SS_CTX);
if (S.notBlank(contextPath)) {
ss = ss.subFolder(contextPath);
}
ss.remove(sobj.getKey());
}
开发者ID:actframework,项目名称:act-storage,代码行数:10,代码来源:StorageServiceManager.java
示例5: testRemoteFetch
import org.osgl.storage.ISObject; //导入依赖的package包/类
@GetAction("/rmt")
public String testRemoteFetch(StorageServiceManager ssm) {
String url = "https://propertymanage.atlassian.net/secure/projectavatar?pid=10400&avatarId=11200";
ISObject sobj = new SObjectResolver().resolve(url);
//sobj.setAttribute(ISObject.ATTR_FILE_NAME, "remote_file.png");
IStorageService ss = ssm.storageService("store1");
sobj = ss.put(ss.getKey(), sobj);
return sobj.getUrl();
}
开发者ID:actframework,项目名称:act-demo-apps,代码行数:10,代码来源:UploadDemo.java
示例6: tryGetFileFrom
import org.osgl.storage.ISObject; //导入依赖的package包/类
private File tryGetFileFrom(ISObject sobj) {
String className = sobj.getClass().getSimpleName();
if (className.contains("FileSObject")) {
return sobj.asFile();
}
return null;
}
开发者ID:actframework,项目名称:actframework,代码行数:8,代码来源:UndertowResponse.java
示例7: resolve
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public String resolve(String bean, String model, ParamValueProvider params) {
try {
ISObject sobj = SObjectBinder.INSTANCE.resolve(null, model, params);
return null == sobj ? fallBack(model, params) : IO.readContentAsString(sobj.asInputStream());
} catch (Exception e) {
return fallBack(model, params);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:ContentStringBinder.java
示例8: resolve
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public List<String> resolve(String value) {
try {
ISObject sobj = SObjectResolver.INSTANCE.resolve(value);
return null == sobj ? fallBack(value) : IO.readLines(sobj.asInputStream());
} catch (Exception e) {
return fallBack(value);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:ContentLinesResolver.java
示例9: resolve
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public String resolve(String value) {
try {
ISObject sobj = SObjectResolver.INSTANCE.resolve(value);
return null == sobj ? fallBack(value) : IO.readContentAsString(sobj.asInputStream());
} catch (Exception e) {
return fallBack(value);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:ContentStringResolver.java
示例10: resolve
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public SObject resolve(String value) {
if (value.startsWith("http://") || value.startsWith("https://")) {
return resolveFromURL(value);
} else if (value.startsWith("data:")) {
int pos = value.indexOf("base64,");
if (pos < 0) {
return null;
}
String encoded = value.substring(pos + "base64,".length());
return resolveFromBase64(encoded);
} else {
File file;
CliContext cli = CliContext.current();
if (null != cli) {
file = cli.getFile(value);
if (file.exists() && file.canRead()) {
return SObject.of(file);
}
} else {
ActionContext act = ActionContext.current();
if (null != act) {
ISObject sobj = act.upload(value);
if (null != sobj) {
return (SObject)sobj;
}
}
}
// last try base64 decoder
try {
return resolveFromBase64(value);
} catch (Exception e) {
Act.LOGGER.warn(S.concat("Cannot resolve SObject from value: ", value));
return null;
}
}
}
开发者ID:actframework,项目名称:actframework,代码行数:38,代码来源:SObjectResolver.java
示例11: resolve
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public List<String> resolve(List<String> bean, String model, ParamValueProvider params) {
try {
ISObject sobj = SObjectBinder.INSTANCE.resolve(null, model, params);
return null == sobj ? fallBack(model, params) : IO.readLines(sobj.asInputStream());
} catch (Exception e) {
return fallBack(model, params);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:10,代码来源:ContentLinesBinder.java
示例12: writeBinary
import org.osgl.storage.ISObject; //导入依赖的package包/类
@Override
public H.Response writeBinary(ISObject binary) {
realResponse.writeBinary(binary);
byte[] ba = binary.asByteArray();
ByteBuffer buffer = ByteBuffer.allocateDirect(ba.length);
buffer.put(ba);
buffer.flip();
this.buffer = buffer;
return this;
}
开发者ID:actframework,项目名称:actframework,代码行数:11,代码来源:ResponseCache.java
示例13: registerBuiltInResolvers
import org.osgl.storage.ISObject; //导入依赖的package包/类
private void registerBuiltInResolvers(AppConfig config) {
// We have the StringValueResolverFinder to handle built in resolver registration
// put(Date.class, new DateResolver(config));
// put(LocalDate.class, new JodaLocalDateCodec(config));
// put(LocalDateTime.class, new JodaLocalDateTimeCodec(config));
// put(LocalTime.class, new JodaLocalTimeCodec(config));
// put(DateTime.class, new JodaDateTimeCodec(config));
// rebind SObjectResolver to ISObject.class in addition to SObject.class
put(ISObject.class, SObjectResolver.INSTANCE);
}
开发者ID:actframework,项目名称:actframework,代码行数:11,代码来源:StringValueResolverManager.java
示例14: upload
import org.osgl.storage.ISObject; //导入依赖的package包/类
public ISObject upload(String name) {
Integer index = attribute(ATTR_CURRENT_FILE_INDEX);
if (null == index) {
index = 0;
}
return upload(name, index);
}
开发者ID:actframework,项目名称:actframework,代码行数:8,代码来源:ActionContext.java
示例15: addUpload
import org.osgl.storage.ISObject; //导入依赖的package包/类
public ActionContext addUpload(String name, ISObject sobj) {
ISObject[] a = uploads.get(name);
if (null == a) {
a = new ISObject[1];
a[0] = sobj;
} else {
ISObject[] newA = new ISObject[a.length + 1];
System.arraycopy(a, 0, newA, 0, a.length);
newA[a.length] = sobj;
a = newA;
}
uploads.put(name, a);
return this;
}
开发者ID:actframework,项目名称:actframework,代码行数:15,代码来源:ActionContext.java
示例16: store
import org.osgl.storage.ISObject; //导入依赖的package包/类
public static ISObject store(FileItemStream fileItemStream, App app) {
UploadFileStorageService ss = app.uploadFileStorageService();
try {
return ss._store(fileItemStream);
} catch (IOException e) {
throw E.ioException(e);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:9,代码来源:UploadFileStorageService.java
示例17: getImage
import org.osgl.storage.ISObject; //导入依赖的package包/类
public ISObject getImage() {
return image;
}
开发者ID:actframework,项目名称:act-demo-apps,代码行数:4,代码来源:Photo.java
示例18: setImage
import org.osgl.storage.ISObject; //导入依赖的package包/类
public void setImage(ISObject image) {
this.image = image;
genThumbnail();
}
开发者ID:actframework,项目名称:act-demo-apps,代码行数:5,代码来源:Photo.java
示例19: getImageUrl
import org.osgl.storage.ISObject; //导入依赖的package包/类
public String getImageUrl() {
return null == image ? "" : image.getAttribute(ISObject.ATTR_URL);
}
开发者ID:actframework,项目名称:act-demo-apps,代码行数:4,代码来源:Photo.java
示例20: getThumbnailUrl
import org.osgl.storage.ISObject; //导入依赖的package包/类
public String getThumbnailUrl() {
return null == thumbnail ? "" : thumbnail.getAttribute(ISObject.ATTR_URL);
}
开发者ID:actframework,项目名称:act-demo-apps,代码行数:4,代码来源:Photo.java
注:本文中的org.osgl.storage.ISObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论