src/java.desktop/share/classes/javax/sound/sampled/DataLine.java

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

@@ -470,23 +470,29 @@
         @Override
         public String toString() {
 
             StringBuilder sb = new StringBuilder();
 
-            if ( (formats.length == 1) && (formats[0] != null) ) {
-                sb.append(" supporting format " + formats[0]);
+            if ((formats.length == 1) && (formats[0] != null)) {
+                sb.append(" supporting format ").append(formats[0]);
             } else if (getFormats().length > 1) {
-                sb.append(" supporting " + getFormats().length + " audio formats");
+                sb.append(" supporting ").append(getFormats().length)
+                        .append(" audio formats");
             }
 
-            if ( (minBufferSize != AudioSystem.NOT_SPECIFIED) && (maxBufferSize != AudioSystem.NOT_SPECIFIED) ) {
-                sb.append(", and buffers of " + minBufferSize + " to " + maxBufferSize + " bytes");
-            } else if ( (minBufferSize != AudioSystem.NOT_SPECIFIED) && (minBufferSize > 0) ) {
-                sb.append(", and buffers of at least " + minBufferSize + " bytes");
+            if ((minBufferSize != AudioSystem.NOT_SPECIFIED)
+                    && (maxBufferSize != AudioSystem.NOT_SPECIFIED)) {
+                sb.append(", and buffers of ").append(minBufferSize)
+                        .append(" to ").append(maxBufferSize).append(" bytes");
+            } else if ((minBufferSize != AudioSystem.NOT_SPECIFIED)
+                    && (minBufferSize > 0)) {
+                sb.append(", and buffers of at least ").append(minBufferSize)
+                        .append(" bytes");
             } else if (maxBufferSize != AudioSystem.NOT_SPECIFIED) {
-                sb.append(", and buffers of up to " + minBufferSize + " bytes");
+                sb.append(", and buffers of up to ").append(minBufferSize)
+                        .append(" bytes");
             }
 
-            return new String(super.toString() + sb);
+            return super.toString() + sb.toString();
         }
     }
 }