Tutorial:
Examples:
Super Junior
Mindless Behavior
What are you thoughts on boy bands?
Do you want to help me start one?
Super Junior
Mindless Behavior
What are you thoughts on boy bands?
Do you want to help me start one?
How to view the contents of a jar file.
Command
// From the cmd line jar -tvf fileName.jar
Example Output
C:\BrowserGUI\dist>jar -tvf BrowserGUI.jar
0 Sat Nov 26 21:46:28 PST 2011 META-INF/
106 Sat Nov 26 21:46:26 PST 2011 META-INF/MANIFEST.MF
39313 Sat Nov 26 21:46:26 PST 2011 GUIAboutTab.class
39952 Sat Nov 26 21:46:26 PST 2011 GUIFrame.class
45354 Sat Nov 26 21:46:26 PST 2011 GUITabbedPane.class
5244 Sat Nov 26 21:46:26 PST 2011 GUImain.class
691 Sat Nov 26 21:46:26 PST 2011 NewJFrame$1.class
509 Sat Nov 26 21:46:26 PST 2011 NewJFrame$2.class
15458 Sat Nov 26 21:46:26 PST 2011 NewJFrame.class
Check out the Java Package Tutorial for more infomation.
REM filename: openAndORCreateFileTXT.bat rem\ >> file.txt && file.txt |
The following will open a existing file named file.txt. However, it if doesn’t exist then it will create it for you then open it. This is very useful.
“rem\” Let’s you return a empty character.
“>> file.txt” appends the returned value on the left hand side, which in this case is nothing.
“&& file.txt” once the left hand operation is done, then open the file ( file.txt).
Groovy Code
/** * @function printAllMethods * @purpose Prints an objects class name and then list the associated class functions. */ // Filename: printAllMethodsExample.groovy void printAllMethods( obj ){ if( !obj ){ println( "Object is null\r\n" ); return; } if( !obj.metaClass && obj.getClass() ){ printAllMethods( obj.getClass() ); return; } def str = "class ${obj.getClass().name} functions:\r\n"; obj.metaClass.methods.name.unique().each{ str += it+"(); "; } println "${str}\r\n"; } |
Example Code
// Filename: printAllMethodsExample.groovy void printAllMethods( obj ){ if( !obj ){ println( "Object is null\r\n" ); return; } if( !obj.metaClass && obj.getClass() ){ printAllMethods( obj.getClass() ); return; } def str = "class ${obj.getClass().name} functions:\r\n"; obj.metaClass.methods.name.unique().each{ str += it+"(); "; } println "${str}\r\n"; } printAllMethods( null ); printAllMethods( 1 ); printAllMethods( "string" ); printAllMethods( [1:1] ); |
Output
Object is null class java.lang.Integer functions: equals(); getClass(); hashCode(); notify(); notifyAll(); toString(); wait(); byteValue(); doubleValue(); floatValue(); intValue(); longValue(); shortValue(); bitCount(); compare(); compareTo(); decode(); getInteger(); highestOneBit(); lowestOneBit(); numberOfLeadingZeros(); numberOfTrailingZeros(); parseInt(); reverse(); reverseBytes(); rotateLeft(); rotateRight(); signum(); toBinaryString(); toHexString(); toOctalString(); valueOf(); class java.lang.String functions: equals(); getClass(); hashCode(); notify(); notifyAll(); toString(); wait(); charAt(); codePointAt(); codePointBefore(); codePointCount(); compareTo(); compareToIgnoreCase(); concat(); contains(); contentEquals(); copyValueOf(); endsWith(); equalsIgnoreCase(); format(); getBytes(); getChars(); indexOf(); intern(); isEmpty(); lastIndexOf(); length(); matches(); offsetByCodePoints(); regionMatches(); replace(); replaceAll(); replaceFirst(); split(); startsWith(); subSequence(); substring(); toCharArray(); toLowerCase(); toUpperCase(); trim(); valueOf(); class java.lang.Class functions: equals(); getClass(); hashCode(); notify(); notifyAll(); toString(); wait(); clear(); containsKey(); containsValue(); entrySet(); get(); isEmpty(); keySet(); put(); putAll(); remove(); size(); values(); clone(); |