< prev index next >

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

Print this page
rev 57600 : 8236980: toString() cleanup in JavaSound
Reviewed-by: XXX

*** 1,7 **** /* ! * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 260,296 **** } return properties.get(key); } /** ! * Provides a string representation of the file format. * ! * @return the file format as a string */ @Override public String toString() { ! ! StringBuffer buf = new StringBuffer(); ! //$$fb2002-11-01: fix for 4672864: AudioFileFormat.toString() throws unexpected NullPointerException ! if (type != null) { ! buf.append(type.toString() + " (." + type.getExtension() + ") file"); ! } else { ! buf.append("unknown file format"); } ! ! if (byteLength != AudioSystem.NOT_SPECIFIED) { ! buf.append(", byte length: " + byteLength); } ! ! buf.append(", data format: " + format); ! ! if (frameLength != AudioSystem.NOT_SPECIFIED) { ! buf.append(", frame length: " + frameLength); } ! ! return new String(buf); } /** * An instance of the {@code Type} class represents one of the standard * types of audio file. Static instances are provided for the common types. --- 260,288 ---- } return properties.get(key); } /** ! * Returns a string representation of the audio file format. * ! * @return a string representation of the audio file format */ @Override public String toString() { ! String str = "Unknown file format"; //$$fb2002-11-01: fix for 4672864: AudioFileFormat.toString() throws unexpected NullPointerException ! if (getType() != null) { ! str = getType() + " (." + getType().getExtension() + ") file"; } ! if (getByteLength() != AudioSystem.NOT_SPECIFIED) { ! str += ", byte length: " + getByteLength(); } ! str += ", data format: " + getFormat(); ! if (getFrameLength() != AudioSystem.NOT_SPECIFIED) { ! str += ", frame length: " + getFrameLength(); } ! return str; } /** * An instance of the {@code Type} class represents one of the standard * types of audio file. Static instances are provided for the common types.
*** 374,387 **** public final int hashCode() { return name != null ? name.hashCode() : 0; } /** ! * Provides the file type's name as the {@code String} representation of ! * the file type. * ! * @return the file type's name */ @Override public final String toString() { return name; } --- 366,378 ---- public final int hashCode() { return name != null ? name.hashCode() : 0; } /** ! * Returns type's name as the string representation of the file type. * ! * @return a string representation of the file type */ @Override public final String toString() { return name; }
< prev index next >