Skip to content

Tag: java

Initiate download from certain byte

I would like to implement a distributed download manager on android that initiates downloads at certain byte lengths. So this way portions of files can be downloaded instead of only from the beginning to the end of the http request. Nothing innovative about it, I just don’t know how to do it. (It’…

Java two varargs in one method

Is there any way in Java to create a method, which is expecting two different varargs? I know, with the same object kind it isn’t possible because the compiler doesn’t know where to start or to end. But why it also isn’t possible with two different Object types? For example: Is there any way…

Load a file from src folder into a reader

I would like to know how can I load a file lol.txt from src folder into my close method. The code so far: Console error output on initiation: Answer If you like to load the file from inside a jar file (i.e. from classpath) please see this answer for more options on how to get an InputStream. In the code

About VM arguments

Am I right in thinking that when one specifies VM arguments in an IDE (I’m using NetBeans in this instance), that these arguments are only passed when the code is run through the IDE itself? Essentially, I’d like to specify that when my program runs, the VM’s minimum/initial heap size is 2Gb…

Splitting a multipage TIFF image into individual images (Java)

Been tearing my hair on this one. How do I split a multipage / multilayer TIFF image into several individual images? Demo image available here. (Would prefer a pure Java (i.e. non-native) solution. Doesn’t matter if the solution relies on commercial libraries.) Answer You can use the Java Advanced Imagi…

How to parse or split URL Address in Java?

If I have url address. https://graph.facebook.com/me/home?limit=25&since=1374196005 Can I get(or split) parameters (avoiding hard coding)? Like this https /// graph.facebook.com /// me/home /// {limit=25, sincse=1374196005} Answer Use Android’s Uri class. http://developer.android.com/reference/andro…