Path: blob/master/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java
41159 views
/*1* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sound.sampled;2627import java.io.Serial;28import java.security.BasicPermission;2930/**31* The {@code AudioPermission} class represents access rights to the audio32* system resources. An {@code AudioPermission} contains a target name but no33* actions list; you either have the named permission or you don't.34* <p>35* The target name is the name of the audio permission (see the table below).36* The names follow the hierarchical property-naming convention. Also, an37* asterisk can be used to represent all the audio permissions.38* <p>39* The following table lists the possible {@code AudioPermission} target names.40* For each name, the table provides a description of exactly what that41* permission allows, as well as a discussion of the risks of granting code the42* permission.43*44* <table class="striped">45* <caption>Permission target name, what the permission allows, and associated46* risks</caption>47* <thead>48* <tr>49* <th scope="col">Permission Target Name50* <th scope="col">What the Permission Allows51* <th scope="col">Risks of Allowing this Permission52* </thead>53* <tbody>54* <tr>55* <th scope="row">play56* <td>Audio playback through the audio device or devices on the system.57* Allows the application to obtain and manipulate lines and mixers for58* audio playback (rendering).59* <td>In some cases use of this permission may affect other60* applications because the audio from one line may be mixed with other61* audio being played on the system, or because manipulation of a mixer62* affects the audio for all lines using that mixer.63* <tr>64* <th scope="row">record65* <td>Audio recording through the audio device or devices on the system.66* Allows the application to obtain and manipulate lines and mixers for67* audio recording (capture).68* <td>In some cases use of this permission may affect other applications69* because manipulation of a mixer affects the audio for all lines using70* that mixer. This permission can enable an applet or application to71* eavesdrop on a user.72* </tbody>73* </table>74*75* @author Kara Kytle76* @since 1.377*/78public class AudioPermission extends BasicPermission {7980/**81* Use serialVersionUID from JDK 1.3 for interoperability.82*/83@Serial84private static final long serialVersionUID = -5518053473477801126L;8586/**87* Creates a new {@code AudioPermission} object that has the specified88* symbolic name, such as "play" or "record". An asterisk can be used to89* indicate all audio permissions.90*91* @param name the name of the new {@code AudioPermission}92* @throws NullPointerException if {@code name} is {@code null}93* @throws IllegalArgumentException if {@code name} is empty94*/95public AudioPermission(final String name) {96super(name);97}9899/**100* Creates a new {@code AudioPermission} object that has the specified101* symbolic name, such as "play" or "record". The {@code actions} parameter102* is currently unused and should be {@code null}.103*104* @param name the name of the new {@code AudioPermission}105* @param actions (unused; should be {@code null})106* @throws NullPointerException if {@code name} is {@code null}107* @throws IllegalArgumentException if {@code name} is empty108*/109public AudioPermission(final String name, final String actions) {110super(name, actions);111}112}113114115