Google App Engine "repackaged" package - java

What is the purpose of the classes in this package?
I want to use Base64 encoding in my app. As I'm typing away in Eclipse, I am prompted if I want to import a class called "com.google.appengine.repackaged.com.google.common.util.Base64"
I can't find any documentation about what this class does. No javadoc, or no mention in the Google App Engine manual (that I can see). Is this some kind of "hidden" API that I'm not supposed to have access to?

Is this some kind of "hidden" API that I'm not supposed to have access to?
Yes.
The purpose of repackaging Java classes is to have a private copy of a library that otherwise might conflict with another version of that some library (that the application developer adds to his project as a jar file).
It is one possible answer to JAR-hell.
Even the JDK makes use of this mechanism, e.g. with com.sun.org.apache.xerces which is an XML parsing library developed by the Apache Project that Sun choose to include (repackaged).
Do not call these classes directly. (You could, and they would probably work okay, but as they are not part of the official API, they could disappear in the next version).

Related

How to know if I'm using external or internal libraries in Java?

So, I have to write this code and it must use only internal Java libraries.
I have to read the HTML content of a URL page and I have managed to do so, but I'm not sure if I have only used internal libraries because I'm not so familiar with Java, can some explain to me please?
I read that if it starts with "Java" it means that is a internal library, but Im not sure.
Below there is a image of what I have used. Thank you.
First pic: used in the main class
Second pic: used in the reader class
If you are not pulling any external dependancies, as external jar's, maven or gradle dependancies, just using what ever JDK provides, then you are using internal Java libraries.
In both of your images imports are from JDK (internal Java libraries).
For other import if it starts with java or javax most likely it is internal library as well.

How can I completely hide classes from Android app package?

A while ago I was decompiling an application with apktool in order to understand some snippets. the curious thing was that the application was obfuscated, in fact , the app presented just one class called "Protection.class" full of method like "class.forName" or "class.getMethod"..
Searching on google this is of course the reflection structure, but, seeing some tutorials I ve understood that the classes called by reflection have to be in the application package. And in my case there are no classes except the "protection" one.
In conclusion my questions are:
Is it possible to completly take off classes from package and nevertheless use their methods in someway? Where they are stored in the apk folder (if they are)?
Is there a way to interact with the apk building process in order to obfuscate code or (like in this case) hide classes from package?
NOTE: Proguard can't do it, I have already tested it in the past
Your screenshot shows that this is an app that is protected by DexGuard (the commercial development of ProGuard that goes a lot further).
See also this answer: What methods are being used to protect this Android APK: Reflection? Encryption? How do I reverse engineer it and analyze it?
you can use progaurd to protect apk file from decompiler. also you can use DexGaurd for better security https://www.guardsquare.com/dexguard
You can use progaurd by php library for it and write a progaurd for your project then attach to your app project in gradle file (in android studio) of progaurd file (in eclipse).
for this php has a fine library named php_progaurd
You can use DexGuard for this purpose. DexGuard has, amongst a lot of other features, the ability to encrypt your classes and decrypt them on runtime. These classes will only be present in memory during runtime, so no sourcecode can be reversed from a static APK. DexGuard is a commercial product developed by the creator of ProGuard. I would you suggest you contact them at helloworld#guardsquare.com.
Cheers,
h4

How do I use MUpdf in an existing java project

Mupdf documentation shows me how to use the library as an application and deploy it. However, I want to suck it into an existing java project and build my application on top of it. Can this be done? If so, how do I bring just the pieces needed, into my project?
Take a look at jMuPdf. I never used it, but it seems to be active.
Otherwise you will need to create Java Native Bindings (JNA or JNI).

Library to access Javadoc from Java

I want to find a library that I can use from my Java application that will allow me to access specific Javadoc in the scope of my project (I specify where Javadocs are located). Just like in Netbeans, I want to potentially access the Javadoc from html files locally and remotely, and from source.
I expect that I could use code from Netbeans to achieve this, but I don't know how, and I can't easily digest their documentation.
Today I started thinking about the same thing.
From CI point of view, I could use #author annotation to send e-mail to someone, who wrote a test that is failing with error, not with a failure.
Google didn't help me (or I didn't google deep enough), so I started wondering how to do it on my own.
First thing that came to my mind is writing a little tool that will check all *.java files specified in a directory, bound file name to annotations and allow user to perform some actions on them.
Is that reasonable?

Accessing information about Java libraries programmatically

I would like to write toy IDE for Java, so I ask a question about one particular thing that as I hope can help me get started.
I have editor implemented on top of swing and i have some text in there. There is for example:
import java.util.List;
Now I need a way to send "java.util.List" string to a method that returns me all the information I may need including JavaDoc document.
So is there any tool that can set up classpath with libraries, that would parse every string I send and try to find if there is any Class/Interface with documentation to return?
So is there any tool that can set up classpath with libraries, that would parse every string I send and try to find if there is any Class/Interface with documentation to return?
AFAIK, no. There is no such free-standing tool or library. You will need to implement it yourself. (Don't expect that writing a Java IDE is simple ... even a "toy" one.)
Libraries will have class files, which will not have javadocs.. So it is not clear what you want to do.
There are many byte code engineering tools to analyse and extract information from class files. For example asm or bcel. Javassist allows to process both source and byte code, so may be close to what you need.
You could use html parser to get the javadoc and other info from the web using the full path to the class (including package names to construct the correct URL per class). This will of course depend on the version of java you are using.
You can also use the javadoc tool from within java to generate the desired documentation from java source files (which can be downloaded from the web). The source code of the tool could also help you out. See http://java.sun.com/j2se/javadoc/faq/#developingwithjavadoc
Lastly, if you need information based on runtime types in your program, you might want to check reflection capabilities.
First you need to know How to print imported java libraries?. Then download java API documentation here. Once you find out imported libraries, open an inputStream in order to read appropriate HTML file.
Beware! This technic will only work when importing from jdk.

Categories