Java Socket programming

How can I read a binary file from a socket input stream which includes textual headers?

Read binary data from a socket

A Web Server in 150 Lines

Java Network Programming, 2nd Edition

How do I recognize EOF in Java Sockets?

Creating a simple java web server

Network programming in Java

 

BufferedReader in =new BufferedReader(
                          new InputStreamReader( Connection.getInputStream() ) );
String s=null;
while ( (s=in.readLine()) != null)  {
//Read HTTP header
     if (s.isEmpty()) break;//No more headers
   }
}