src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java
Print this page
rev 10520 : 8055723[client]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>
@@ -270,30 +270,29 @@
* @return the file format as a string
*/
@Override
public String toString() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
//$$fb2002-11-01: fix for 4672864: AudioFileFormat.toString() throws unexpected NullPointerException
if (type != null) {
- buf.append(type.toString() + " (." + type.getExtension() + ") file");
+ sb.append(type).append(" (.").append(type.getExtension()).append(") file");
} else {
- buf.append("unknown file format");
+ sb.append("unknown file format");
}
if (byteLength != AudioSystem.NOT_SPECIFIED) {
- buf.append(", byte length: " + byteLength);
+ sb.append(", byte length: ").append(byteLength);
}
- buf.append(", data format: " + format);
+ sb.append(", data format: ").append(format);
if (frameLength != AudioSystem.NOT_SPECIFIED) {
- buf.append(", frame length: " + frameLength);
+ sb.append(", frame length: ").append(frameLength);
}
-
- return new String(buf);
+ return sb.toString();
}
/**
* An instance of the {@code Type} class represents one of the standard
* types of audio file. Static instances are provided for the common types.