Eclipse Galileo SR2 is available

There is a great news for developers who use Eclipse – version Galileo SR2 is available for download from eclipse.org.

If you don’t want to download the full packages, you can start an upgrade – that’s what I did just a few minutes ago (Help -> Check . . . → Read More: Eclipse Galileo SR2 is available

  • Share/Bookmark

Getting separator symbol in Java

This snippet of code allows to get symbol which represents separator in . . . → Read More: Getting separator symbol in Java

  • Share/Bookmark

Writing files in Java

I am going to show example which shows how to write a file in Java.
If you want to write some file you should start with FileOutputStream. This class is a concrete subclass of OutputStream.
Example:

package tutorial;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
* This class shows how to write a file
* @author The Developer’s Info
*/
public class Main . . . → Read More: Writing files in Java

  • Share/Bookmark

Reading files in Java

I am going to show example which shows how to read a file in Java.
If you want to read some file you should start with FileInputStream. This class is a concrete subclass of InputStream. It provides an input stream connected to a particular file.
Example:

package tutorial;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;

/**
* This class shows how to read . . . → Read More: Reading files in Java

  • Share/Bookmark

Getting system root directory in Java

If you are working with file-system in Java, you should understand that your program can run in other types of OS:(Windows, Unix, Linux).
These OS has own file-system structure. For example you need to read or write file in Windows, which located at disk C:\, you should write:

File root = new File(“C:\\”);
File dir = new File(root, “someDir”);
File . . . → Read More: Getting system root directory in Java

  • Share/Bookmark

Getting path to user’s home directory in Java

There is a way to find out path to user’s home folder. Need to get system . . . → Read More: Getting path to user’s home directory in Java

  • Share/Bookmark

Getting working directory in Java

Sometimes need to know path to your working directory.
It is very easy. Here I am going to show snippet of code which helps with this:

System.getProperty(“user.dir”);

It returns String. Call it and you will know your current . . . → Read More: Getting working directory in Java

  • Share/Bookmark

Using InputStream in Java

InputStream is the abstract super class for all input streams. It declares the three basic methods needed to read bytes of data from a stream. It also has methods for closing streams, checking how many bytes of data are available to be read, skipping over input, marking a position in a stream and resetting back to that position, and determining whether marking and resetting are supported. Continue reading Using InputStream in Java

  • Share/Bookmark

Using OutputStream in Java

OutputStream class declares basic methods which you need to write bytes of data onto a stream. Continue reading Using OutputStream in Java

  • Share/Bookmark

Using Scanner for reading data from system console in Java

Java has one more way for reading data from system console. Scanner was introduced in Java 1.5. Continue reading Using Scanner for reading data from system console in Java

  • Share/Bookmark