@Override public long length() { return sobj.getLength(); }
@Override public long getLength() { return null == sobj_ ? -1 : sobj_.getLength(); }
@Override public long getLength() { return sobj.getLength(); }
@Override public long getLength() { return null == sobj_ ? -1 : sobj_.getLength(); }
@Override public long getLength() { return buf().getLength(); }
@Override public void put(final String key, final ISObject sobj) throws UnexpectedIOException { if (putAsync) { putLater(key, sobj, ss, _.F0, new _.F1<Throwable, Void>() { @Override public Void apply(Throwable e) { Logger.warn(e, "error put storage object with key[%s]. persist into GridFS", key); gs.put(key, sobj); return null; } }); long len = sobj.getLength(); // suppose the network transfer 100K per second String timeout = (5 + len / (1000 * 100)) + "s"; Cache.set(key, sobj, timeout); } else { ss.put(key, sobj); } }
@Override protected void doPut(String fullPath, ISObject stuff, Map<String, String> attrs) { ObjectMetadata meta = new ObjectMetadata(); meta.setContentType(stuff.getAttribute(ISObject.ATTR_CONTENT_TYPE)); if (!(stuff instanceof SObject.InputStreamSObject)) { long length = stuff.getLength(); if (0 < length) { meta.setContentLength(stuff.getLength()); } } PutObjectRequest req = new PutObjectRequest(bucket, fullPath, stuff.asInputStream(), meta); req.setTagging(mapToTagList(attrs)); StorageClass storageClass = StorageClass.valueOfIgnoreCase(attrs.remove(ATTR_STORAGE_CLASS), defStorageClass); if (null != storageClass) { req.setStorageClass(storageClass.toString()); } req.withCannedAcl(CannedAccessControlList.PublicRead); s3.putObject(req); }
@Override protected void doPut(String fullPath, ISObject stuff, Map<String, String> attrs) { try { CloudBlockBlob blob = blobContainer.getBlockBlobReference(fullPath); if (!(stuff instanceof SObject.InputStreamSObject)) { blob.upload(stuff.asInputStream(), stuff.getLength()); } BlobProperties props = blob.getProperties(); // content-type contains "-" which is illegal character in C# identifier // so we have to remove it from meta map String contentType = attrs.remove(ISObject.ATTR_CONTENT_TYPE); if (S.notBlank(contentType)) { props.setContentType(contentType); } blob.uploadProperties(); blob.getMetadata().putAll(attrs); blob.uploadMetadata(); } catch (Exception e) { throw E.unexpected(e); } }
@Override public ISObject put(String key, ISObject stuff) { String processedKey = key; if (storeSuffix) { String originalFilename = stuff.getAttribute(ISObject.ATTR_FILE_NAME); if (null != originalFilename) { String suffix = S.afterLast(originalFilename, "."); if (S.notBlank(suffix)) { suffix = S.concat(".", suffix); if (!key.endsWith(suffix)) { processedKey = S.concat(key, suffix); } } } } if ((S.eq(key, stuff.getKey()) || S.eq(processedKey, stuff.getKey()) && isManagedObject(stuff))) { return stuff; } Map<String, String> attrs = stuff.getAttributes(); removeRuntimeAttributes(attrs); if (!(stuff instanceof SObject.InputStreamSObject)) { long len = stuff.getLength(); if (0L < len) { attrs.put(ISObject.ATTR_CONTENT_LENGTH, S.string(len)); } } doPut(keyWithContextPath(processedKey), stuff, attrs); return getFull(processedKey); }
FileItemStream item = iter.next(); ISObject sobj = UploadFileStorageService.store(item, context.app()); if (sobj.getLength() == 0L) { continue;
FileItemStream item = iter.next(); ISObject sobj = UploadFileStorageService.store(item, context.app()); if (sobj.getLength() == 0L) { continue;