private void printToHost(String host,int port,byte[] cmds) throws IOException {
  log.debug("Printing to host {}:{}",host,port);
  try (Socket socket=new Socket(host,port);DataOutputStream out=new DataOutputStream(socket.getOutputStream())){
    out.write(cmds);
  }
 }

private void printToHost ( String host , int port , byte [ ] cmds ) throws IOException { log . debug ( "Printing to host {}:{}" , host , port ) ; try ( Socket socket = new Socket ( host , port ) ; DataOutputStream out = new DataOutputStream ( socket . getOutputStream ( ) ) ) { out . write ( cmds ) ; } }
a brute - force , however surprisingly elegant way to send a file to a networked printer . < p / > please note that this will completely bypass the print spooler , so the operating system will have absolutely no printer information . this is printing " blind " .
