1 7 8 package javax.sound.sampled; 9 10 56 public interface Line { 57 58 63 public Line.Info getLineInfo(); 64 65 109 public void open() throws LineUnavailableException ; 110 111 112 124 public void close(); 125 126 127 128 137 public boolean isOpen(); 138 139 140 147 public Control [] getControls(); 148 149 156 public boolean isControlSupported(Control.Type control); 157 158 159 170 public Control getControl(Control.Type control); 171 172 173 182 public void addLineListener(LineListener listener); 183 184 185 190 public void removeLineListener(LineListener listener); 191 192 193 224 public static class Info { 225 226 229 private final Class lineClass; 230 231 232 238 public Info(Class <?> lineClass) { 239 240 if (lineClass == null) { 241 this.lineClass = Line .class; 242 } else { 243 this.lineClass = lineClass; 244 } 245 } 246 247 248 249 253 public Class <?> getLineClass() { 254 return lineClass; 255 } 256 257 258 275 public boolean matches(Info info) { 276 277 285 286 292 296 303 if (! (this.getClass().isInstance(info)) ) { 304 return false; 305 } 306 307 308 312 if (! (getLineClass().isAssignableFrom(info.getLineClass())) ) { 313 return false; 314 } 315 316 return true; 317 } 318 319 320 324 public String toString() { 325 326 String fullPackagePath = "javax.sound.sampled."; 327 String initialString = new String (getLineClass().toString()); 328 String finalString; 329 330 int index = initialString.indexOf(fullPackagePath); 331 332 if (index != -1) { 333 finalString = initialString.substring(0, index) + initialString.substring( (index + fullPackagePath.length()), initialString.length() ); 334 } else { 335 finalString = initialString; 336 } 337 338 return finalString; 339 } 340 341 } 343 } | Popular Tags |