src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java

Print this page
rev 10537 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 102     @Override
 103     int length() {
 104         return 6 + algorithmsLen;
 105     }
 106 
 107     @Override
 108     void send(HandshakeOutStream s) throws IOException {
 109         s.putInt16(type.id);
 110         s.putInt16(algorithmsLen + 2);
 111         s.putInt16(algorithmsLen);
 112 
 113         for (SignatureAndHashAlgorithm algorithm : algorithms) {
 114             s.putInt8(algorithm.getHashValue());      // HashAlgorithm
 115             s.putInt8(algorithm.getSignatureValue()); // SignatureAlgorithm
 116         }
 117     }
 118 
 119     @Override
 120     public String toString() {
 121         StringBuilder sb = new StringBuilder();

 122         boolean opened = false;
 123         for (SignatureAndHashAlgorithm signAlg : algorithms) {
 124             if (opened) {
 125                 sb.append(", " + signAlg.getAlgorithmName());
 126             } else {
 127                 sb.append(signAlg.getAlgorithmName());
 128                 opened = true;
 129             }
 130         }
 131 
 132         return "Extension " + type + ", signature_algorithms: " + sb;
 133     }
 134 }
 135 


 102     @Override
 103     int length() {
 104         return 6 + algorithmsLen;
 105     }
 106 
 107     @Override
 108     void send(HandshakeOutStream s) throws IOException {
 109         s.putInt16(type.id);
 110         s.putInt16(algorithmsLen + 2);
 111         s.putInt16(algorithmsLen);
 112 
 113         for (SignatureAndHashAlgorithm algorithm : algorithms) {
 114             s.putInt8(algorithm.getHashValue());      // HashAlgorithm
 115             s.putInt8(algorithm.getSignatureValue()); // SignatureAlgorithm
 116         }
 117     }
 118 
 119     @Override
 120     public String toString() {
 121         StringBuilder sb = new StringBuilder();
 122         sb.append("Extension ").append(type).append(", signature_algorithms: ");
 123         boolean opened = false;
 124         for (SignatureAndHashAlgorithm signAlg : algorithms) {
 125             if (opened) {
 126                 sb.append(", ").append(signAlg.getAlgorithmName());
 127             } else {
 128                 sb.append(signAlg.getAlgorithmName());
 129                 opened = true;
 130             }
 131         }
 132         return  sb.toString();

 133     }
 134 }
 135