source: trunk/source/visualization/VRML/g4vrmlview/g4mini.java@ 1091

Last change on this file since 1091 was 834, checked in by garnier, 17 years ago

import all except CVS

File size: 2.7 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id: g4mini.java,v 1.4 2006/06/29 21:25:15 gunter Exp $
28// GEANT4 tag $Name: $
29//
30import java.io.*;
31import java.net.*;
32
33public class g4mini
34{
35 public static void main( String[] args )
36 {
37 try{
38
39 // port number
40 final int DEFALUT_PORT_NO = 40801 ;
41 int portNo = DEFALUT_PORT_NO ;
42
43 // argument checking
44 if( args.length != 2 )
45 {
46 System.out.println( "Usage: java g4mini src_file server_hostname");
47 return ;
48 }
49 String src = args[0];
50 String server = args[1];
51
52 // open connection
53 Socket socket = new Socket( server, portNo ) ;
54
55 // get input stream from file
56 BufferedReader br
57 = new BufferedReader ( new FileReader ( src ) ) ;
58
59 // get output stream to socket
60 BufferedWriter bw
61 = new BufferedWriter ( new OutputStreamWriter ( socket.getOutputStream() ) ) ;
62
63 // file ==> socket
64 String line ;
65 while ( (line = br.readLine()) != null )
66 {
67 bw.write( line );
68 bw.newLine() ;
69 bw.flush () ;
70 }
71
72 // close streams
73 br.close();
74 bw.close();
75 socket.close() ;
76 }
77
78 catch( Exception e )
79 {
80 System.out.println( e.toString() );
81 }
82 } // main
83}
Note: See TracBrowser for help on using the repository browser.