Socket programming and networking examples in Java.
In local file system, files could be accessed by using URL class. Hence, file opening is an easy task done by URL class, if your code is needed to find out whether file came from local file system or network. How a file could be opened in local file system by URL class is shown in this example: URL url = new URL("file:/c:/data/test.txt"); Java Code: URLConnection urlConnection = url.openConnection(); InputStream input = urlConnection.getInputStream(); ...
URLConnection urlConnection = url.openConnection(); InputStream input = urlConnection.getInputStream();
License4J 4.0
05-22-2013, 12:23 AM in Java Software