Skip to content
Advertisement

Tag: file-permissions

listFiles() returns null on /storage/emulated, while /storage/emulated/0 exists

I am testing on android 27 emulator and trying to traverse some directories. When I try to traverse /storage/emulated directory, the method listFiles() returns null while there /storage/emulated/0 exists. Here is a testing code: P.S. I have added the proper storage permission in manifest and granted the runtime permission. Answer Short answer: Android won’t grant your app a permission to

How to check if a PDF is Password Protected or not

I am trying to use iText’s PdfReader to check if a given PDF file is password protected or not, but am getting this exception: Exception in thread “Main Thread” java.lang.NoClassDefFoundError:org/bouncycastle/asn1/ASN1OctetString But when testing the same code against a non-password protected file it runs fine. Here is the complete code: Answer Use Apache PDFBox – Java PDF Library from here:Sample Code:

Setting file permissions returns FALSE always

The code: On Ubuntu all 3 calls return false. On my Windows only the 3rd call to setWritable returns false. The target is to create the file/dir so the user (tomcat) and the group will be able to read/write. BUT the file created on Ubuntu without permissions for the group to write. Answer I found the solution and will answer

Advertisement