@Override public ObjectStatus[] getObjectStatuses() { StorageObject[] objects = mChunk.getObjects(); ObjectStatus[] ret = new ObjectStatus[objects.length]; for (int i = 0; i < ret.length; ++i) { ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(), objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime()); } return ret; }
@Override public InputStream openStream() throws IOException { try { final long start; final long end = objectDetails.getContentLength() - 1; if (offset > 0 && offset < objectDetails.getContentLength()) { start = offset; } else if (offset < 0 && (-1 * offset) < objectDetails.getContentLength()) { start = objectDetails.getContentLength() + offset; } else { start = 0; } return service.getObject( config.getS3Bucket(), taskKey, null, null, new String[]{objectDetails.getETag()}, null, start, end ).getDataInputStream(); } catch (ServiceException e) { throw new IOException(e); } } }
@SuppressWarnings("deprecation") public boolean isDirectoryPlaceholder() { // Recognize "standard" directory place-holder indications used by // Amazon's AWS Console and Panic's Transmit. if (this.getKey().endsWith("/") && this.getContentLength() == 0) { return true; } // Recognize s3sync.rb directory placeholders by MD5/ETag value. if ("d66759af42f282e1ba19144df2d405d0".equals(this.getETag())) { return true; } // Recognize place-holder objects created by the Google Storage console // or S3 Organizer Firefox extension. if (this.getKey().endsWith("_$folder$") && this.getContentLength() == 0) { return true; } // Recognize legacy JetS3t directory place-holder objects, only gives // accurate results if an object's metadata is populated. if (this.getContentLength() == 0 && Mimetypes.MIMETYPE_JETS3T_DIRECTORY.equals(this.getContentType())) { return true; } return false; }
@SuppressWarnings("deprecation") public boolean isDirectoryPlaceholder() { // Recognize "standard" directory place-holder indications used by // Amazon's AWS Console and Panic's Transmit. if (this.getKey().endsWith("/") && this.getContentLength() == 0) { return true; } // Recognize s3sync.rb directory placeholders by MD5/ETag value. if ("d66759af42f282e1ba19144df2d405d0".equals(this.getETag())) { return true; } // Recognize place-holder objects created by the Google Storage console // or S3 Organizer Firefox extension. if (this.getKey().endsWith("_$folder$") && this.getContentLength() == 0) { return true; } // Recognize legacy JetS3t directory place-holder objects, only gives // accurate results if an object's metadata is populated. if (this.getContentLength() == 0 && Mimetypes.MIMETYPE_JETS3T_DIRECTORY.equals(this.getContentType())) { return true; } return false; }
public List<ListItem> listAll(String path) { m_logger.debug("Start list all: " + path); try { List<ListItem> result = new ArrayList<>(); String priorLastKey = null; while(true) { StorageObjectsChunk chunk = m_s3service.listObjectsChunked(BUCKET, path, "/", CHUNK_SIZE, priorLastKey); m_logger.trace("ListObjects: {}", path); inc(); StorageObject[] objects = chunk.getObjects(); for(int i = 0; i < objects.length; i++) { String key = objects[i].getKey(); if(key.endsWith("/")) key = key.substring(0, key.length() - 1); key = key.substring(path.length(), key.length()); ListItem item = new ListItem(key, objects[i].getContentLength() != 0); result.add(item); } if(chunk.isListingComplete()) break; priorLastKey = chunk.getPriorLastKey(); } return result; } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public ObjectStatus[] getObjectStatuses() { StorageObject[] objects = mChunk.getObjects(); ObjectStatus[] ret = new ObjectStatus[objects.length]; for (int i = 0; i < ret.length; ++i) { ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(), objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime()); } return ret; }
for (int i = 0; i < runnables.length; i++) { incompletedObjectsList.add(objects[i]); BytesProgressWatcher progressMonitor = new BytesProgressWatcher(objects[i].getContentLength()); runnables[i] = new CreateObjectRunnable(bucketName, objects[i], progressMonitor); progressWatchers.add(progressMonitor);
for (int i = 0; i < runnables.length; i++) { incompletedObjectsList.add(objects[i]); BytesProgressWatcher progressMonitor = new BytesProgressWatcher(objects[i].getContentLength()); runnables[i] = new CreateObjectRunnable(bucketName, objects[i], progressMonitor); progressWatchers.add(progressMonitor);
&& object.getContentLength() == 0 && !object.isDirectoryPlaceholder())
if (filepath == null && object.getContentLength() == 0 && !relativeObjectKey.endsWith("/") && "d41d8cd98f00b204e9800998ecf8427e".equals(object.getETag()))
if (filepath == null && object.getContentLength() == 0 && !relativeObjectKey.endsWith("/") && "d41d8cd98f00b204e9800998ecf8427e".equals(object.getETag()))
@Override public FileMetadata retrieveMetadata(String key) throws IOException { StorageObject object = null; try { LOG.debug("Getting metadata for key: {} from bucket: {}", key, bucket.getName()); object = s3Service.getObjectDetails(bucket.getName(), key); return new FileMetadata(key, object.getContentLength(), object.getLastModifiedDate().getTime()); } catch (ServiceException e) { try { // process handleException(e, key); return null; } catch (FileNotFoundException fnfe) { // and downgrade missing files return null; } } finally { if (object != null) { object.closeDataInputStream(); } } }
&& object.getContentLength() == 0 && !object.isDirectoryPlaceholder())
objects[i] = downloadPackages[i].getObject(); BytesProgressWatcher progressMonitor = new BytesProgressWatcher(objects[i].getContentLength());
objects[i] = downloadPackages[i].getObject(); BytesProgressWatcher progressMonitor = new BytesProgressWatcher(objects[i].getContentLength());
if(object.containsMetadata(StorageObject.METADATA_HEADER_CONTENT_LENGTH)) { if(log.isDebugEnabled()) { log.debug("Uploading object data with Content-Length: " + object.getContentLength()); object.getDataInputStream(), object.getContentType(), object.getContentLength(), getJetS3tProperties(), isLiveMD5HashingRequired(object));
if(object.containsMetadata(StorageObject.METADATA_HEADER_CONTENT_LENGTH)) { if(log.isDebugEnabled()) { log.debug("Uploading object data with Content-Length: " + object.getContentLength()); object.getDataInputStream(), object.getContentType(), object.getContentLength(), getJetS3tProperties(), isLiveMD5HashingRequired(object));
null == part.getLastModifiedDate() ? new Date(System.currentTimeMillis()) : part.getLastModifiedDate(), null == part.getETag() ? StringUtils.EMPTY : part.getETag(), part.getContentLength());
StorageObject object = chunk.getObjects()[i]; fileMetadata[i] = new FileMetadata(object.getKey(), object.getContentLength(), object.getLastModifiedDate().getTime());
public PathAttributes toAttributes(final StorageObject object) { final PathAttributes attributes = new PathAttributes(); attributes.setSize(object.getContentLength()); final Date lastmodified = object.getLastModifiedDate(); if(lastmodified != null) {