Need to make changes in my code to connect to a server file

Discussions

EJB programming & troubleshooting: Need to make changes in my code to connect to a server file

  1.      public void amethod(){
    try{
     //From file (This is where I need to make the changes)
     //In order to connect to a Server file
    FileInputStream fis = new FileInputStream("Out.txt");
     //DataInputStream allows you to read
    DataInputStream dis = new DataInputStream(fis);
            
     //Create file
    FileOutputStream fos = new FileOutputStream("Out1.txt");
     //DataOutputStream allows you to write
    DataOutputStream dos = new DataOutputStream(fos);

    while(true){
              //This line reads and writes to a file
                     dos.writeShort(dis.readShort());
               }
                    }catch(IOException ioe) {}
              }
  2. What type of server. if it is a http server.
    you can use java.net.URL and URLConnection and get the InputStream from the connection..

  3. Thanks for the hint. Could you give me more of an idea of how I can go about it. Never done this sort of stuffs.
  4. URL anyURL = new URL("http://localhost/anyfile.ext");
    BufferedInputStream buf = new BufferedInputStream(anyURL.openStream());