is it possible to hide file on external storage? - java

I want to hide my pdf file, I tried encrypting file but I got out of memory error because file is too big.I try add "." front of file name like that ".pdfs/" but it doesn't work.
is there any solution this case?
I use download manager library here, It is prevent to download internal storage, I have to use external storage

I tried encrypting file but I got out of memory error because file is too big
Then instead of reading whole file and encrypting such huge block of data, read it in smaller portions, encrypt these portions, save it and then read another portion for encryption. Repeat until done.
I use download manager library, It is prevent to download internel storage, I have to use external storage
But you do not have to use Download Manager so once you fetch the file yourself, you can store it whenever you want incl. your own private storage of your choice.

Related

ImageIO with encrypted File cache

Problem:
I read and write large multipage tiffs. During my test I have seen plain tiffs on disk. I know I can disable writing to disk with
ImageIO.setUseCache(false)
but then all data is in memory, what may lead to OutOfMemoryException.
Is there any way to encrypt the cache/temp file created by ImageIO.createImageInputStream() and ImageIO.createImageOutputStream()?
My current variants, what I can/will try
Registering a custom ImageInputStream/ImageOutputStream(Spi)for encrypted files similar to "javax.imageio.stream.FileImageInputStream". Is there any documentation/tutorial how to do that?
Extends RandomAccessFile to write encrypted and read decrypted to/from file due to existing "javax.imageio.stream.FileImageInputStream" already accepts RandomAccessFile. Is there already a solution for that?
last hope is to secure/encrypt the temp folder outside of my java app, but that would be error prone.
PS: I would use AES128/256 encryption with temp. key/IV (save that in memory) !

Android Print Manager - return saved pdf file path

Using Android PrintManager API user can save content as PDF into device's internal/external directory.
I need to get that PDF file's path as soon as it is created. Is there any way to do this directly without having to use a file chooser?
Any ideas are appreciated.
Using Android PrintManager API we can save content as PDF into device's internal/external directory.
No. The user can elect to send your print job to a PDF file that is stored locally. The user could elect to do something else:
Send it to an actual printer
Send it to something else (e.g., Cloud Print)
Abandon the print job
Is there any way to do this directly without having to use a file chooser?
No, simply because there is no requirement for the user to save the content to a local PDF file in a place that you can access. In addition to all the above non-PDF alternatives, the user could save it as a PDF to removable storage, in a directory that your app cannot access.
I need to get that PDF file's path as soon as it is created
Then the PrintManager API is not suitable. Generate a PDF some other way (e.g., iText).

When do files in the Android getCacheDir() get deleted? What is a better option for long term storage?

I'm using the following code to save and retrieve image files (JPG) on Android:
File cacheDir = context.getCacheDir();
When do these files get deleted? From what I have read this dir is not reliable as the device can delete them at any time to make space for other things. What is a better option for local storage of image files needed for my app? I'd like to rely on a permanent storage, not an SD removable card if possible.
You can use the app bundle space to keep your files.. I do that in my apps using:
openFileOutput()
You can see there that there is also openFileInput() to read your files, to keep the files private, make sure you use MODE_PRIVATE flag with the openFileOutput() method.
Good luck!

Android - How to package documents into an app

I'm trying to create an app and have the ability to save files to /data/data/(packagename)/files or a directory similar to that. The goal would be to have a pdf or doc handler, as necessary, open the files stored on the internal storage and be viewed by the user. I have the code to get a pdf reader that is installed and display the file but I do not know how to package the files so they are installed in a directory like the one above. Also, if I am able to do this would I use getResources to access the files? How should the file structure look in eclipse to make this happen on install of the APK?
I do prefer to have the files stored internally (they are small) and not on the SD card.
I admit I am new to this and am trying to learn as I go. Thanks for the help!
As I understand your approach you only need to place your files to assets folder of your application and then just copy them to the internal storage. Read more here.

Any Java plugin/code to manage uploaded files?

According to current requirement,user will upload files with large size,which he may like to download later. I cannot store the uploaded files in DB because the size of files is large and performance will be impacted if I store uploaded files in DB.
Any one knows any java plugin which provide efficient file management on webserver and maintains the link to file so that the file can be downloaded when the link is requested. Also the code will make sure that user will be able to download only those files which is uploaded by them,they cannot download any file just by modifying the download link etc. I am using spring3 as the framework.
Please suggest how to solve this problem?
if you have write access to the file system why not just save them there ?
you then generate an unique ID and save the hash/file relation in db, you then need to supply the ID to get the file feed from a servlet
Store the file content on a part of filesystem out of web application so you cannot reach it changing the link.
Then you can store on db the path for that file, and return them only if the user has the permissions to read it.
Pay attention, do not store all the file on the same folder, or the number of files could grow too much. So find a way to store them with more folder levels.

Categories

Resources