Ad
Showing posts with label Software - Java. Show all posts
Showing posts with label Software - Java. Show all posts
Wednesday, January 8, 2014
Java bitwise operations and bit masks
I recently needed to refresh my understanding of simple bitwise operations.
Here is a good article i used to understand it: http://rodrigosasaki.com/2013/06/06/bit-shift-and-bitwise-operators/
This article explains how to represent various options in a bit mask: http://www.vipan.com/htdocs/bitwisehelp.html
Tuesday, June 7, 2011
Java Heap Space
The issue which most developers come across is the OutOfMemory: perm space error, which usually leads to increasing the JVM's perm space, here is great explanation on the details of java heap space:
http://www.freshblurbs.com/explaining-java-lang-outofmemoryerror-permgen-space
http://www.freshblurbs.com/explaining-java-lang-outofmemoryerror-permgen-space
Wednesday, March 9, 2011
Loading files from classpath
Here is a great tip for loading resources in classpath from within Java:
// From ClassLoader, all paths are "absolute" already - there's no context
// from which they could be relative. Therefore you don't need a leading slash.
InputStream in = this.getClass().getClassLoader().getResourceAsStream("SomeTextFile.txt");
// From Class, the path is relative to the package of the class unless
// you include a leading slash, so if you don't want to use the current
// package, include a slash like this:
InputStream in = this.getClass().getResourceAsStream("/SomeTextFile.txt");
//If you dont include the '/path' in the above example and the class your calling this from is in package
// com.me.happy then it will look for that resource in that package
InputStream in = this.getClass().getResourceAsStream("SomeTextFile.txt");
// From ClassLoader, all paths are "absolute" already - there's no context
// from which they could be relative. Therefore you don't need a leading slash.
InputStream in = this.getClass().getClassLoader().getResourceAsStream("SomeTextFile.txt");
// From Class, the path is relative to the package of the class unless
// you include a leading slash, so if you don't want to use the current
// package, include a slash like this:
InputStream in = this.getClass().getResourceAsStream("/SomeTextFile.txt");
//If you dont include the '/path' in the above example and the class your calling this from is in package
// com.me.happy then it will look for that resource in that package
InputStream in = this.getClass().getResourceAsStream("SomeTextFile.txt");
Subscribe to:
Posts (Atom)
