com.google.cloud.storage.Blob.isDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中com.google.cloud.storage.Blob.isDirectory()方法的一些代码示例,展示了Blob.isDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Blob.isDirectory()方法的具体详情如下:
包路径:com.google.cloud.storage.Blob
类名称:Blob
方法名:isDirectory

Blob.isDirectory介绍

暂无

代码示例

代码示例来源:origin: googleapis/google-cloud-java

assertEquals(CONTENT_TYPE, remoteBlob.getContentType());
 assertEquals(BLOB_BYTE_CONTENT.length, (long) remoteBlob.getSize());
 assertFalse(remoteBlob.isDirectory());
} else if (remoteBlob.getName().equals(directoryName + subdirectoryName)) {
 assertEquals(0L, (long) remoteBlob.getSize());
 assertTrue(remoteBlob.isDirectory());
} else {
 fail("Unexpected blob with name " + remoteBlob.getName());

代码示例来源:origin: googleapis/google-cloud-java

assertEquals(UPDATE_TIME, blob.getUpdateTime());
assertEquals(storage.getOptions(), blob.getStorage().getOptions());
assertFalse(blob.isDirectory());
builder = new Blob.Builder(new Blob(storage, new BlobInfo.BuilderImpl(DIRECTORY_INFO)));
blob = builder.setBlobId(BlobId.of("b", "n/")).setIsDirectory(true).setSize(0L).build();
assertEquals(0L, (long) blob.getSize());
assertNull(blob.getUpdateTime());
assertTrue(blob.isDirectory());

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

private static String getLastModifiedTimestamp(Blob blob) {
 if (blob.isDirectory()) {
  return "-";
 }
 SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yy h:mm a");
 return dateFormat.format(new Date(blob.getUpdateTime()));
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

private static String getBlobType(Blob blob) {
 return blob.isDirectory() ? "Folder" : blob.getContentType();
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

private static String getBlobSize(Blob blob) {
 return blob.isDirectory() ? "-" : toHumanReadableByteSize(blob.getSize());
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@Override
 public void mouseClicked(MouseEvent event) {
  if (event.getClickCount() == 2 && tableModel != null) {
   Blob selectedBlob =
     tableModel.getBlobAt(bucketContentTable.rowAtPoint(event.getPoint()));
   if (selectedBlob != null && selectedBlob.isDirectory()) {
    updateTableModel(selectedBlob.getName());
   }
  }
 }
});

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@Before
public void setUp() {
 GcsTestUtils.setupVirtualFileWithBucketMocks(bucketVirtualFile);
 when(loginService.isLoggedIn()).thenReturn(true);
 when(directoryBlob.isDirectory()).thenReturn(true);
 when(directoryBlob.getName()).thenReturn(DIR_NAME);
 when(binaryBlob.isDirectory()).thenReturn(false);
 when(binaryBlob.getName()).thenReturn(BLOB_NAME);
 when(binaryBlob.getSize()).thenReturn(1024L);
 when(binaryBlob.getContentType()).thenReturn(BLOB_CONTENT_TYPE);
 when(binaryBlob.getUpdateTime()).thenReturn(0L);
 when(binaryBlobInDirectory.getName()).thenReturn(NESTED_BLOB_FULL_NAME);
 // TODO: consider shutting down timer instead when clear what is creating the timer.
 ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(), "Timer-0");
}

相关文章