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

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


 455                         if (! (dataLineInfo.isFormatSupported(localFormats[i])) ) {
 456                             return false;
 457                         }
 458                     }
 459                 }
 460             }
 461 
 462             return true;
 463         }
 464 
 465         /**
 466          * Obtains a textual description of the data line info.
 467          *
 468          * @return a string description
 469          */
 470         @Override
 471         public String toString() {
 472 
 473             StringBuilder sb = new StringBuilder();
 474 
 475             if ( (formats.length == 1) && (formats[0] != null) ) {
 476                 sb.append(" supporting format " + formats[0]);
 477             } else if (getFormats().length > 1) {
 478                 sb.append(" supporting " + getFormats().length + " audio formats");

 479             }
 480 
 481             if ( (minBufferSize != AudioSystem.NOT_SPECIFIED) && (maxBufferSize != AudioSystem.NOT_SPECIFIED) ) {
 482                 sb.append(", and buffers of " + minBufferSize + " to " + maxBufferSize + " bytes");
 483             } else if ( (minBufferSize != AudioSystem.NOT_SPECIFIED) && (minBufferSize > 0) ) {
 484                 sb.append(", and buffers of at least " + minBufferSize + " bytes");




 485             } else if (maxBufferSize != AudioSystem.NOT_SPECIFIED) {
 486                 sb.append(", and buffers of up to " + minBufferSize + " bytes");

 487             }
 488 
 489             return new String(super.toString() + sb);
 490         }
 491     }
 492 }


 455                         if (! (dataLineInfo.isFormatSupported(localFormats[i])) ) {
 456                             return false;
 457                         }
 458                     }
 459                 }
 460             }
 461 
 462             return true;
 463         }
 464 
 465         /**
 466          * Obtains a textual description of the data line info.
 467          *
 468          * @return a string description
 469          */
 470         @Override
 471         public String toString() {
 472 
 473             StringBuilder sb = new StringBuilder();
 474 
 475             if ((formats.length == 1) && (formats[0] != null)) {
 476                 sb.append(" supporting format ").append(formats[0]);
 477             } else if (getFormats().length > 1) {
 478                 sb.append(" supporting ").append(getFormats().length)
 479                         .append(" audio formats");
 480             }
 481 
 482             if ((minBufferSize != AudioSystem.NOT_SPECIFIED)
 483                     && (maxBufferSize != AudioSystem.NOT_SPECIFIED)) {
 484                 sb.append(", and buffers of ").append(minBufferSize)
 485                         .append(" to ").append(maxBufferSize).append(" bytes");
 486             } else if ((minBufferSize != AudioSystem.NOT_SPECIFIED)
 487                     && (minBufferSize > 0)) {
 488                 sb.append(", and buffers of at least ").append(minBufferSize)
 489                         .append(" bytes");
 490             } else if (maxBufferSize != AudioSystem.NOT_SPECIFIED) {
 491                 sb.append(", and buffers of up to ").append(minBufferSize)
 492                         .append(" bytes");
 493             }
 494 
 495             return super.toString() + sb.toString();
 496         }
 497     }
 498 }