How to determine given file is a class file?
-
Hello, I need to determine that whether given file is a class file or not? Perhaps I may change the extension to .exe/.xml or some other . I need to dtermine that given file if a class file will be parsed differently and if it would be some other, it'll be parsed in that manner. How can we determine by reading class file format if, How can we read programatically class file format? Regards Usman
-
Hello, I need to determine that whether given file is a class file or not? Perhaps I may change the extension to .exe/.xml or some other . I need to dtermine that given file if a class file will be parsed differently and if it would be some other, it'll be parsed in that manner. How can we determine by reading class file format if, How can we read programatically class file format? Regards Usman
What are you trying to do exactly ? What is the reason why you want to do something like that ? Are you talking about .java files ?
glitteringsound wrote:
How can we read programatically class file format?
A class loader does that for you.
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
What are you trying to do exactly ? What is the reason why you want to do something like that ? Are you talking about .java files ?
glitteringsound wrote:
How can we read programatically class file format?
A class loader does that for you.
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++I need to just read and parse programatically Java class file header. So that I can determine weather its class file or not. I need that one to determine in my case. Possibly not in usual cases but just in my case.
-
I need to just read and parse programatically Java class file header. So that I can determine weather its class file or not. I need that one to determine in my case. Possibly not in usual cases but just in my case.
glitteringsound wrote:
I need to just read and parse programatically Java class file header.
What do you mean by header ? :confused: But you still didn't answer my question, you merely repeated your first post: what is the reason why you want to do something like that ? Your request seems really akward, so it would help a lot to understand your question if you provide the context.
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
glitteringsound wrote:
I need to just read and parse programatically Java class file header.
What do you mean by header ? :confused: But you still didn't answer my question, you merely repeated your first post: what is the reason why you want to do something like that ? Your request seems really akward, so it would help a lot to understand your question if you provide the context.
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++Respectfully Sir, I am working on app (kind of framework) which parse and extract function signatures and populate them on GUI. This needs to be first determine weather given file is a class file, Win32 File or COM Exe/DLL, Js or HTML file.(As in my case these all files can be made as input to framework by the user). This needs to parse given file format (probably headers)first to determine whether given file is within above mentioned context or not.? Regards Usman
-
Respectfully Sir, I am working on app (kind of framework) which parse and extract function signatures and populate them on GUI. This needs to be first determine weather given file is a class file, Win32 File or COM Exe/DLL, Js or HTML file.(As in my case these all files can be made as input to framework by the user). This needs to parse given file format (probably headers)first to determine whether given file is within above mentioned context or not.? Regards Usman
glitteringsound wrote:
I am working on app (kind of framework) which parse and extract function signatures and populate them on GUI.
Are the classes loaded in your application ? If yes, it would be much easier to use reflection to extract the information about the classes and methods (you won't need to do the parsing yourself, which is not an easy job).
glitteringsound wrote:
This needs to parse given file format (probably headers)first to determine whether given file is within above mentioned context or not.?
A class file is just a text file, so there's no "header" (like for instance in a binary file) containing info about the file. You could check the extension though (it should be .java).
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
Hello, I need to determine that whether given file is a class file or not? Perhaps I may change the extension to .exe/.xml or some other . I need to dtermine that given file if a class file will be parsed differently and if it would be some other, it'll be parsed in that manner. How can we determine by reading class file format if, How can we read programatically class file format? Regards Usman
-
Respectfully Sir, I am working on app (kind of framework) which parse and extract function signatures and populate them on GUI. This needs to be first determine weather given file is a class file, Win32 File or COM Exe/DLL, Js or HTML file.(As in my case these all files can be made as input to framework by the user). This needs to parse given file format (probably headers)first to determine whether given file is within above mentioned context or not.? Regards Usman
Hope, this is something of your interest... http://www.rgagnon.com/javadetails/java-0487.html[^] The above code is in Java. If you program for MFC, Windows API provides sufficient support for analysis of file headers. Another useful information can be read here: http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html[^] ~UJ.