Exemple #1
0
 /**
  * Converts e.g. DXT1 compression format constant (see {@link #getCompressionFormat}) into "DXT1".
  *
  * @param compressionFormat Compression format constant
  * @return String format code
  */
 public static String getCompressionFormatName(int compressionFormat) {
   StringBuffer buf = new StringBuffer();
   for (int i = 0; i < 4; i++) {
     char c = (char) (compressionFormat & 0xFF);
     buf.append(c);
     compressionFormat = compressionFormat >> 8;
   }
   return buf.toString();
 }
 public String toString() {
   StringBuffer sb = new StringBuffer();
   sb.append(this.getClass().getSuperclass().getName());
   sb.append('[');
   if (!isOpen()) sb.append("closed");
   else {
     synchronized (stateLock) {
       switch (state) {
         case ST_UNCONNECTED:
           sb.append("unconnected");
           break;
         case ST_PENDING:
           sb.append("connection-pending");
           break;
         case ST_CONNECTED:
           sb.append("connected");
           if (!isInputOpen) sb.append(" ishut");
           if (!isOutputOpen) sb.append(" oshut");
           break;
       }
       if (localAddress() != null) {
         sb.append(" local=");
         sb.append(localAddress().toString());
       }
       if (remoteAddress() != null) {
         sb.append(" remote=");
         sb.append(remoteAddress().toString());
       }
     }
   }
   sb.append(']');
   return sb.toString();
 }