public class GDriveDownloader extends Object
Modifier and Type | Field and Description |
---|---|
private static String |
APPLICATION_NAME |
private static String |
CLASSNAME
A holder This classes name (used when logging).
|
static String |
CLASSPATH
The VM classpath (used in some methods)..
|
private static com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets |
clientSecrets_ |
private File |
dataStoreDir_
Directory to store user credentials.
|
private com.google.api.client.util.store.FileDataStoreFactory |
dataStoreFactory_
Global instance of the
DataStoreFactory . |
private static String |
DEFAULT_DATASTORE_DIR |
private static String |
DEFAULT_DOWNLOAD_DIR |
private static String |
DEFAULT_LOAD_FILENAME |
private String |
dirForDownload_ |
private Drive |
drive
Class Drive API client.
|
private static String |
ECRYPT_FILEMARKER
The Extension to use on the filename to markk it as AESEncrypted.
|
private com.google.api.client.http.HttpTransport |
httpTransport_
Class instance of the HTTP transport.
|
private com.google.api.client.json.JsonFactory |
jsonFactory_
Class instance of the JSON factory.
|
private File |
loadFile_ |
private String |
loadFilePath_ |
static String |
SYSTEM_FILE_SEPERATOR
A holder for this clients System File Separator.
|
static String |
SYSTEM_LINE_SEPERATOR
A holder for this clients System line termination separator.
|
static String |
USERDIR
The users pwd ditrectory.
|
static String |
USERHOME
The users home ditrectory.
|
Constructor and Description |
---|
GDriveDownloader() |
GDriveDownloader(String filenameToLoad) |
Modifier and Type | Method and Description |
---|---|
private com.google.api.client.auth.oauth2.Credential |
authorize() |
private void |
downloadFile(boolean useDirectDownload,
File fileToDownload)
Downloads a file using either resumable or direct media download.
|
private String |
getloadFilePath()
get the filename path for the file that will be uploaded.
|
private void |
initDrive(com.google.api.client.auth.oauth2.Credential cred) |
private com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets |
initSecrets()
Loads the Google secrets / api usage authentication coses for this class.
|
static void |
main(String[] args) |
private void |
setloadFilePath(String path)
Set the filename path for the file that will be uploaded.
|
public static final String SYSTEM_FILE_SEPERATOR
public static final String SYSTEM_LINE_SEPERATOR
private static final String APPLICATION_NAME
private static final String DEFAULT_DOWNLOAD_DIR
private static final String DEFAULT_LOAD_FILENAME
private static final String DEFAULT_DATASTORE_DIR
private static final String ECRYPT_FILEMARKER
private static com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets clientSecrets_
private String loadFilePath_
private String dirForDownload_
private File dataStoreDir_
private com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory_
DataStoreFactory
. The best practice is to make it a single
globally shared instance across your application.private com.google.api.client.http.HttpTransport httpTransport_
private com.google.api.client.json.JsonFactory jsonFactory_
public GDriveDownloader() throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public GDriveDownloader(String filenameToLoad) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
private void setloadFilePath(String path)
private String getloadFilePath()
private void initDrive(com.google.api.client.auth.oauth2.Credential cred)
private com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets initSecrets() throws IOException
IOException
private com.google.api.client.auth.oauth2.Credential authorize() throws Exception
Exception
private void downloadFile(boolean useDirectDownload, File fileToDownload) throws IOException
IOException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses