本文整理了Java中com.google.api.services.drive.model.File.getModifiedTime()
方法的一些代码示例,展示了File.getModifiedTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.getModifiedTime()
方法的具体详情如下:
包路径:com.google.api.services.drive.model.File
类名称:File
方法名:getModifiedTime
[英]The last time the file was modified by anyone (RFC 3339 date-time). Note that setting modifiedTime will also update modifiedByMeTime for the user.
[中]任何人上次修改文件的时间(RFC 3339日期时间)。请注意,设置modifiedTime还将为用户更新ModifiedByTime。
代码示例来源: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: google/data-transfer-project
new DigitalDocumentWrapper(
new DtpDigitalDocument(
file.getName(), file.getModifiedTime().toStringRfc3339(), newMimeType),
file.getMimeType(),
file.getId()));
代码示例来源:origin: siom79/jdrivesync
private void createLocalDir(File newDirectory, SyncItem syncItem, com.google.api.services.drive.model.File remoteFile) throws IOException {
LOGGER.log(Level.FINE, "Creating local directory '" + syncItem.getPath() + "'.");
Path newLocalDir = fileSystemAdapter.createDirectory(newDirectory);
DateTime lastModifiedDateTime = remoteFile.getModifiedTime();
fileSystemAdapter.setLastModifiedTime(newLocalDir.toFile(), lastModifiedDateTime.getValue());
syncItem.setLocalFile(Optional.of(newLocalDir.toFile()));
}
代码示例来源: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
copyStreamToFile(inputStream, newFile);
syncItem.setLocalFile(Optional.of(newFile));
setLastModifiedTime(newFile, remoteFile.getModifiedTime().getValue());
} else {
LOGGER.log(Level.WARNING, "Cannot create file '" + syncItem.getPath() + "' because local file is not present.");
copyStreamToFile(inputStream, newFile);
syncItem.setLocalFile(Optional.of(newFile));
setLastModifiedTime(newFile, remoteFile.getModifiedTime().getValue());
代码示例来源:origin: iterate-ch/cyberduck
if(f.getModifiedTime() != null) {
attributes.setModificationDate(f.getModifiedTime().getValue());
代码示例来源: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
BasicFileAttributes attr = Files.readAttributes(localFile.toPath(), BasicFileAttributes.class);
FileTime modifiedDateLocal = attr.lastModifiedTime();
DateTime modifiedDateRemote = remoteChild.getModifiedTime();
long sizeLocal = attr.size();
Long sizeRemote = remoteChild.getSize() == null ? 0L : remoteChild.getSize();
代码示例来源:origin: siom79/jdrivesync
private void performChecksumCheck(File file, SyncItem syncItem, com.google.api.services.drive.model.File remoteFile, boolean updateMetadata) {
String remoteFileMd5Checksum = remoteFile.getMd5Checksum();
String localFileMd5Checksum = computeMd5Checksum(file);
if (remoteFileMd5Checksum.equals(localFileMd5Checksum)) {
syncItem.setLocalFile(Optional.of(file));
if (!updateMetadata) {
LOGGER.log(Level.FINE, "Not downloading file '" + syncItem.getPath() + "' because MD5 checksums are equal (local: " + localFileMd5Checksum + ", remote: " + remoteFileMd5Checksum + ").");
ReportFactory.getInstance(options).log(new ReportEntry(syncItem.getPath(), ReportEntry.Status.Synchronized, ReportEntry.Action.Unchanged));
} else {
try {
fileSystemAdapter.setLastModifiedTime(file, remoteFile.getModifiedTime().getValue());
ReportFactory.getInstance(options).log(new ReportEntry(syncItem.getPath(), ReportEntry.Status.Synchronized, ReportEntry.Action.UpdatedMetadata));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Could not update last modification date of local file '" + file.getAbsolutePath() + "':" + e.getMessage(), e);
ReportFactory.getInstance(options).log(new ReportEntry(syncItem.getPath(), ReportEntry.Status.Error, ReportEntry.Action.Skipped, e.getMessage()));
}
}
} else {
LOGGER.log(Level.FINE, "Downloading file '" + syncItem.getPath() + "' because MD5 checksums are not equal (local: " + localFileMd5Checksum + ", remote: " + remoteFileMd5Checksum + ").");
try {
InputStream stream = googleDriveAdapter.downloadFile(syncItem);
fileSystemAdapter.storeFile(stream, syncItem);
ReportFactory.getInstance(options).log(new ReportEntry(syncItem.getPath(), ReportEntry.Status.Synchronized, ReportEntry.Action.Updated));
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to store file '" + syncItem.getPath() + "': " + e.getMessage());
ReportFactory.getInstance(options).log(new ReportEntry(syncItem.getPath(), ReportEntry.Status.Error, ReportEntry.Action.Skipped));
}
}
}
});
代码示例来源: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: com.github.robozonky/robozonky-integration-stonky
final File s = o.latestStonky();
LOGGER.debug("Making a backup of the existing spreadsheet.");
final Instant lastModified = Instant.EPOCH.plus(Duration.ofMillis(s.getModifiedTime().getValue()));
final LocalDate d = lastModified.atZone(Defaults.ZONE_ID).toLocalDate();
if (d.isBefore(DateUtil.localNow().toLocalDate())) {
代码示例来源: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;
}
代码示例来源:origin: RoboZonky/robozonky
final File s = o.latestStonky();
LOGGER.debug("Making a backup of the existing spreadsheet.");
final Instant lastModified = Instant.EPOCH.plus(Duration.ofMillis(s.getModifiedTime().getValue()));
final LocalDate d = lastModified.atZone(Defaults.ZONE_ID).toLocalDate();
if (d.isBefore(DateUtil.localNow().toLocalDate())) {
代码示例来源:origin: siom79/jdrivesync
performChecksumCheck(file, syncItem, remoteFile, false);
} else {
DateTime remoteFileModifiedDate = remoteFile.getModifiedTime();
try {
BasicFileAttributes attr = fileSystemAdapter.readAttributes(file);
内容来源于网络,如有侵权,请联系作者删除!