< prev index next >
src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java
Print this page
rev 57600 : 8236980: toString() cleanup in JavaSound
Reviewed-by: XXX
*** 1,7 ****
/*
! * Copyright (c) 1999, 2018, 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
*** 138,163 ****
public final long getFramePosition() {
return position;
}
/**
! * Obtains a string representation of the event. The contents of the string
! * may vary between implementations of Java Sound.
*
! * @return a string describing the event
*/
@Override
public String toString() {
! String sType = "";
! if (type != null) sType = type.toString()+" ";
! String sLine;
! if (getLine() == null) {
! sLine = "null";
! } else {
! sLine = getLine().toString();
! }
! return new String(sType + "event from line " + sLine);
}
/**
* The LineEvent.Type inner class identifies what kind of event occurred on
* a line. Static instances are provided for the common types (OPEN, CLOSE,
--- 138,154 ----
public final long getFramePosition() {
return position;
}
/**
! * Returns a string representation of the event.
*
! * @return a string representation of the event
*/
@Override
public String toString() {
! return String.format("%s event from line %s", type, getLine());
}
/**
* The LineEvent.Type inner class identifies what kind of event occurred on
* a line. Static instances are provided for the common types (OPEN, CLOSE,
*** 205,217 ****
public final int hashCode() {
return super.hashCode();
}
/**
! * Returns the type name as the string representation.
*
! * @return the type name as the string representation
*/
@Override
public String toString() {
return name;
}
--- 196,208 ----
public final int hashCode() {
return super.hashCode();
}
/**
! * Returns type's name as the string representation of the event type.
*
! * @return a string representation of the event type
*/
@Override
public String toString() {
return name;
}
< prev index next >