Java Reference
In-Depth Information
pw - client - out.println ( " ADC =" + adc - value);
pw - client - out.println (fWebPageBot);
pw - client - out.flush ();
}
else {// Or just send a requested file
// Open a stream to the file. Remember that
// by this point all the text except for
// the file name has been stripped from the
// " request " string.
FileInputStream file - in =
new FileInputStream (file - name);
// Send the header.
File file = new File (file - name);
Date date = new Date (file.lastModified ());
pw - client - out.print ( " Date: " + date +
"\ r \ n " );
pw - client - out.print ("Server: MicroServer
1.0\r\n");
pw - client - out.print ("Content-length: " +
file - in.available () +
"\r\n");
pw - client - out.print ("Content-type: " +
content - type +
"\r\n\r\n");
pw - client - out.flush ();
// For PrintStream with SNAP
// Creat a byte array to hold the file.
byte [] data =
new byte [file - in.available ()];
file - in.read (data);
// Read file into the byte array
client - out.write (data);
// Write it to client output stream
client - out.flush ();
// Remember to flush output buffer
file - in.close (); // Close file input stream
}
}
catch (IllegalAddressException err) {
 
Search WWH ::




Custom Search