This snippet of code allows to get symbol which represents separator in your file-system:
System.getProperty(“file.separator”);
| |||||
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 . . . →Read More:Writing 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 . . . →Read More:Reading files 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 . . . →Read More:Getting system root directory in Java | |||||
| Copyright ©2012 The Developer's Info - All Rights Reserved | |||||
Recent Comments