Stay organized with collections
Save and categorize content based on your preferences.
GCSFileDownloader
public
class
GCSFileDownloader
extends GCSCommon
implements
IFileDownloader
File downloader to download file from google cloud storage (GCS).
Summary
Public methods |
InputStream
|
downloadFile(String bucketName, String filename)
Download a file from a GCS bucket file.
|
void
|
downloadFile(String remotePath, File destFile)
Alternate form of downloadFile(String) , that allows caller to specify the
destination file the remote contents should be placed in.
|
File
|
downloadFile(String remoteFilePath)
Download file from GCS.
|
boolean
|
isFresh(File localFile, String remotePath)
Check local file's freshness.
|
Fields
GCS_APPROX_PREFIX
public static final String GCS_APPROX_PREFIX
GCS_PREFIX
public static final String GCS_PREFIX
Public constructors
GCSFileDownloader
public GCSFileDownloader (File jsonKeyFile)
Parameters |
jsonKeyFile |
File |
GCSFileDownloader
public GCSFileDownloader ()
Public methods
downloadFile
public InputStream downloadFile (String bucketName,
String filename)
Download a file from a GCS bucket file.
Parameters |
bucketName |
String : GCS bucket name |
filename |
String : the filename |
downloadFile
public void downloadFile (String remotePath,
File destFile)
Alternate form of downloadFile(String)
, that allows caller to specify the
destination file the remote contents should be placed in.
Parameters |
remotePath |
String : the remote path to the file to download, relative to an
implementation-specific root. |
destFile |
File : the file to place the downloaded contents into. Should not exist. |
downloadFile
public File downloadFile (String remoteFilePath)
Download file from GCS.
Right now only support GCS path.
Parameters |
remoteFilePath |
String : gs://bucket/file/path format GCS path. |
isFresh
public boolean isFresh (File localFile,
String remotePath)
Check local file's freshness. If local file is the same as remote file, then it's fresh. If
not, local file is stale. This is mainly used for cache. The default implementation will
always return true, so if the file is immutable it will never need to check freshness.
Parameters |
localFile |
File : local file. |
remotePath |
String : remote file path. |
Returns |
boolean |
True if local file is fresh, otherwise false. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-08-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-08-03 UTC."],[],[]]