本文整理了Java中com.google.api.services.drive.model.File.getSize()
方法的一些代码示例,展示了File.getSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.getSize()
方法的具体详情如下:
包路径:com.google.api.services.drive.model.File
类名称:File
方法名:getSize
[英]The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
[中]文件内容的大小(以字节为单位)。这仅适用于驱动器中包含二进制内容的文件。
代码示例来源:origin: apache/incubator-gobblin
private FileStatus toFileStatus(File metadata) {
return new FileStatus(metadata.getSize() == null ? 0L : metadata.getSize(),
FOLDER_MIME_TYPE.equals(metadata.getMimeType()),
-1,
-1,
metadata.getModifiedTime().getValue(),
new Path(metadata.getId()));
}
代码示例来源:origin: org.apache.gobblin/google-ingestion
private FileStatus toFileStatus(File metadata) {
return new FileStatus(metadata.getSize() == null ? 0L : metadata.getSize(),
FOLDER_MIME_TYPE.equals(metadata.getMimeType()),
-1,
-1,
metadata.getModifiedTime().getValue(),
new Path(metadata.getId()));
}
代码示例来源:origin: siom79/jdrivesync
private boolean fileShouldBeIgnored(String name, boolean isDirectory, File file) {
boolean matches = options.getIgnoreFiles().matches(name, isDirectory);
if (matches && LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Ignoring file '" + name + "' because the name matches the ignore list.");
}
if (!matches && options.getMaxFileSize().isPresent()) {
if (!googleDriveAdapter.isDirectory(file)) {
Long fileSize = file.getSize();
Long maxFileSize = options.getMaxFileSize().get();
if (maxFileSize.compareTo(fileSize) < 0) {
matches = true;
LOGGER.log(Level.FINE, "Ignoring '" + name + "' because file is bigger than maxFileSize (file: " + fileSize + ", maxFileSize: " + maxFileSize + ").");
}
}
}
return matches;
}
}
代码示例来源:origin: siom79/jdrivesync
DateTime modifiedDateRemote = remoteChild.getModifiedTime();
long sizeLocal = attr.size();
Long sizeRemote = remoteChild.getSize() == null ? 0L : remoteChild.getSize();
if (!datesAreEqual(modifiedDateLocal.toMillis(), modifiedDateRemote.getValue(), syncItem)) {
LOGGER.log(Level.FINE, "Last modification dates are not equal for file '" + syncItemFound.getPath() + "' (local: " + DATE_FORMAT.format(new Date(modifiedDateLocal.toMillis())) + "; remote: " + DATE_FORMAT.format(new Date(modifiedDateRemote.getValue())) + "). Checking MD5 checksums.");
代码示例来源:origin: iterate-ch/cyberduck
if(null != f.getSize()) {
if(!DRIVE_FOLDER.equals(f.getMimeType())
&& !StringUtils.startsWith(f.getMimeType(), GOOGLE_APPS_PREFIX)) {
attributes.setSize(f.getSize());
代码示例来源:origin: andresoviedo/google-drive-ftp-adapter
private GFile create(File file) {
GFile newFile = new GFile(file.getName() != null ? file.getName() : file.getOriginalFilename());
newFile.setId(file.getId());
newFile.setLastModified(file.getModifiedTime() != null ? file.getModifiedTime().getValue() : 0);
newFile.setDirectory(GFile.MIME_TYPE.GOOGLE_FOLDER.getValue().equals(file.getMimeType()));
newFile.setSize(file.getSize() != null ? file.getSize() : 0); // null for directories
newFile.setMimeType(file.getMimeType());
newFile.setMd5Checksum(file.getMd5Checksum());
if (file.getParents() != null) {
Set<String> newParents = new HashSet<>();
for (String newParent : file.getParents()) {
newParents.add(newParent.equals(ROOT_FOLDER_ID) ? "root" : newParent);
}
newFile.setParents(newParents);
} else {
// does this happen?
newFile.setParents(Collections.singleton("root"));
}
newFile.setTrashed(file.getTrashed() != null && file.getTrashed());
return newFile;
}
代码示例来源:origin: siom79/jdrivesync
FileTime localLastModifiedTime = attr.lastModifiedTime();
long sizeLocal = attr.size();
long sizeRemote = remoteFile.getSize() == null ? 0L : remoteFile.getSize();
if (!datesAreEqual(localLastModifiedTime.toMillis(), remoteFileModifiedDate.getValue(), syncItem)) {
LOGGER.log(Level.FINE, "Last modification dates are not equal for file '" + syncItem.getPath() + "' (local: " + DATE_FORMAT.format(new Date(localLastModifiedTime.toMillis())) + "; remote: " + DATE_FORMAT.format(new Date(remoteFileModifiedDate.getValue())) + "). Checking MD5 checksums.");
代码示例来源:origin: Talend/components
private IndexedRecord convertSearchResultToIndexedRecord(File file) {
// Main record
IndexedRecord main = new GenericData.Record(schema);
main.put(0, file.getId());
main.put(1, file.getName());
main.put(2, file.getMimeType());
main.put(3, file.getModifiedTime().getValue());
main.put(4, file.getSize());
main.put(5, file.getKind());
main.put(6, file.getTrashed());
main.put(7, file.getParents().toString()); // TODO This should be a List<String>
main.put(8, file.getWebViewLink());
return main;
}
代码示例来源:origin: org.talend.components/components-googledrive-runtime
private IndexedRecord convertSearchResultToIndexedRecord(File file) {
// Main record
IndexedRecord main = new GenericData.Record(schema);
main.put(0, file.getId());
main.put(1, file.getName());
main.put(2, file.getMimeType());
main.put(3, file.getModifiedTime().getValue());
main.put(4, file.getSize());
main.put(5, file.getKind());
main.put(6, file.getTrashed());
main.put(7, file.getParents().toString()); // TODO This should be a List<String>
main.put(8, file.getWebViewLink());
return main;
}
内容来源于网络,如有侵权,请联系作者删除!