Exemplo n.º 1
0
 /**
  * ** Writes the specified line to the specified socket's output stream ** @param socket The
  * socket which's output stream to write to ** @param val The line to write to the socket output
  * stream. A newline is ** appended if it does not already end with one. ** @throws IOException if
  * an error occurs
  */
 protected static void socketWriteLine(Socket socket, String val) throws IOException {
   if (val != null) {
     String lineTerm = ClientSocketThread.getLineTerminator();
     String v = val.endsWith(lineTerm) ? val : (val + lineTerm);
     ClientSocketThread.socketWriteBytes(socket, StringTools.getBytes(v), 0, -1);
   }
 }
Exemplo n.º 2
0
 /** ** Scrambles String */
 public static String _ens64(String d) {
   if (!StringTools.isBlank(d)) {
     return Base64.encode(StringTools.getBytes(d), getBase64Alphabet(), Base64Pad);
   } else {
     return "";
   }
 }
Exemplo n.º 3
0
 /**
  * ** Writes the specified String to the specified socket's output stream ** @param socket The
  * socket which's output stream to write to ** @param val The String to write to the socket output
  * stream. ** @throws IOException if an error occurs
  */
 protected static void socketWriteString(Socket socket, String val) throws IOException {
   if (val != null) {
     ClientSocketThread.socketWriteBytes(socket, StringTools.getBytes(val), 0, -1);
   }
 }