Is it possible to write an image directly to Google Drive? - java

I have searched Google Drive API reference as well as the Internet for an answer but I haven't found any.
Is it possible to write an image directly to Google Drive from Java app?
I know that you can upload files to Google Drive from local file system via Java app, but that is not what I want.
I have a Java app that is creating an image - BufferedImage object. To save in the local file system, I use javax.imageio.ImageIO.write method and it works well.
However, what I would like to do, is to somehow write that BufferedImage directly to my Google Drive so I don't have to write it to the local file system and then upload it to Google Drive.
Thanks for help :]

Related

How to read txt file from Google Drive?

I'm trying to make launcher for my game. I want it to display update log. How I want it to work:
Replace log.txt file on Google Drive and new log will be displayed in launcher.
I have no idea how to make this. Also I have to make auto-updater.
It will work similiar to update log - upload .jar file and res folder on drive. When game launched it will check for updates and if new update available it will download it.
Like I said, I have no idea how to do this.
I advise you to use GitHub to upload your files. Then you can use the URL provided by GitHub to open a urlStream in your project and read that file like a .txt.
Google drive is a file explorer only. It will allow you to upload and download files, it does not have the power to display or edit them. Unless you want to display them in the Google drive web application in which case there should be a webContentLink available in the response data for the file.get method, however the file will need to be either public or the user must have access to it in order to be able to see it.
To display the file you will need to download it and display it locally. To edit it you will need to download the file and edit it then upload it again.
Tbh i think what you are asking is out of scope for this api.

How can I use youtubeinmp3 in my app?

I want to create an mp3 downloader application,After some research i found a solution which is YoutubeinMp3 API but I don't know how can i use this api. API official link is as follow https://www.youtubeinmp3.com/api/
"I need know how can I use API of the youtubeinmp3... Can you give me an example?"
The API link you provided is the manual with example. Scroll down to Direct Links section an read that for reference (the fetch part of URL gives you the MP3 data). You simply access your link as:
https://www.youtubeinmp3.com/fetch/?video=https://www.youtube.com/watch?v=12345
where you replace the 12345 with actual video ID for required video (eg: iOWamCtnwTc). Example :
https://www.youtubeinmp3.com/fetch/?video=https://www.youtube.com/watch?v=iOWamCtnwTc
And it will return the bytes of mp3 (in desktop browser testing this will begin downloading to hard drive). So in Android you simply receive the bytes to a ByteArray and then save those bytes as file in your storage location.
You can check some tutorials like Download from Internet and save to SD but actually any tutorial about saving file from internet (whether image or MP3 or whatever) can be adjusted to instead use your the API link as download source.

How to use Google Cloud storage to upload image file?

These couple day I have been trying to upload images to the Google cloud using Java. However, I did found some source codes around but amazingly, none of them come with the handy lib jar files. I am trying to search for the required jar file but still can not found them all. Here, I am asking, does any one have the sample code that I just directly run? The change of the settings is a necessary but definitely not for libs.
All you need is Java Client for Google Cloud Storage
Howto you will find here: Getting Started

How to convert a File into a StorageObject (Google API)

I'm trying to store a file into Google NearLine using a java program and Google's Cloud Storage API. But I'm having difficulty finding out how to do this.
I think I have to convert the File object into a StorageObject, but not sure how to do it.
Here's a link to the doc's for the StorageObject.
https://developers.google.com/resources/api-libraries/documentation/storage/v1beta2/java/latest/com/google/api/services/storage/model/StorageObject.html#set(java.lang.String,%20java.lang.Object)
Thanks.
Note: I've been using this link as a guide:
https://cloud.google.com/storage/docs/json_api/v1/json-api-java-samples
However, this only shows you how to access the bucket, not upload files to the bucket.
To upload files, use Storage.Objects.Insert: https://developers.google.com/resources/api-libraries/documentation/storage/v1beta2/java/latest/com/google/api/services/storage/Storage.Objects.Insert.html

Custom password encrypted file system for storing files in Android

is it possible to create a custom file system or use an existing file system like EncFs to read data inside Android environment.
My idea is to make a virtual filesystem for storing some media files and developing an app which can directly access those files from the filesystem volume.
I hope im clear with my question.!!
Yes, but you need a rooted devices to use it. Or, you need to build your own firmware. Here's one, it's open source: http://nemesis2.qx.net/pages/LUKSManager

Categories