• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Read a file with java.io.FileInputStream passing IP Adress

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

I need to read a file in Java by the command:

fis = new java.io.FileInputStream ("file.txt");

However, this "file.txt", is on a remote machine, where I have the IP address = 177.55.99.146.

How do I "pass" this file by IP address? In other words, it would be something like this:

fis = new java.io.FileInputStream ("177.55.99.14:\c:\arquivo.txt"); ???

I have no idea how to solve this.

Thank you.

Fernando
 
author
Posts: 23836
140
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fernando Skackauskas wrote:
fis = new java.io.FileInputStream ("file.txt");

However, this "file.txt", is on a remote machine, where I have the IP address = 177.55.99.146.

How do I "pass" this file by IP address? In other words, it would be something like this:

fis = new java.io.FileInputStream ("177.55.99.14:\c:\arquivo.txt"); ???

I have no idea how to solve this.



The FileInputStream class is used to open a file in the file system. So, to access the file system on another machine, you need a networked file system. How do you access the file, on your machine, without Java? Once you figure that out, then you can do it the same way in Java.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!