By Oleg Mazurashu,on February 25th,2010% 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 . . . →Read More:Reading files in Java By Oleg Mazurashu,on February 25th,2010% 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 . . . →Read More:Getting system root directory in Java By Oleg Mazurashu,on February 25th,2010% There is a way to find out path to user’s home folder. Need to get system property: System.getProperty(“user.home”); That’s all. By Oleg Mazurashu,on February 25th,2010% 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 working directory. By Oleg Mazurashu,on February 24th,2010% 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 . . . →Read More:Using InputStream in Java By Oleg Mazurashu,on February 24th,2010% OutputStream class declares basic methods which you need to write bytes of data onto a stream. . . . →Read More:Using OutputStream in Java By Oleg Mazurashu,on February 22nd,2010% Java has one more way for reading data from system console. Scanner was introduced in Java 1.5. . . . →Read More:Using Scanner for reading data from system console in Java By Oleg Mazurashu,on February 22nd,2010% Java 6 allows to read data from system console with Console class. There are several ways to do it,but I personally like this one. . . . →Read More:Reading data from console with Console class in Java By Oleg Mazurashu,on February 22nd,2010% Sometimes need to redirect System.out,System.in,System.err. It is very easy. I am going to show here how you can do it. . . . →Read More:Redirecting System.out,System.in,System.err in Java | A sample text widgetEtiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa. Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna,tincidunt vitae molestie nec,molestie at mi. Nulla nulla lorem,suscipit in posuere in,interdum non magna. | "If people do not believe that architecture is simple,it is only because they do not realize how complicated life is." - J.H. von Neumann |
Recent Comments