Java FilePermission getActions()方法與示例

FilePermission類的getActions()方法 (FilePermission Class getActions() method)

  • getActions() method is available in java.io package.

    getActions()方法在java.io包中可用。

  • getActions() method is used to check whether this FilePermission and the given object are equal or not in terms of pathname and actions like read, write, delete, execute, delete, etc.

    getActions()方法用于檢查此FilePermission和給定對象在路徑名和諸如讀取,寫入,刪除,執行,刪除等操作方面是否相等。

  • getActions() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    getActions()方法是一種非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • getActions() method does not throw an exception at the time of getting actions.

    getActions()方法在獲取操作時不會引發異常。

Syntax:

句法:

    public String getActions();

Parameter(s):

參數:

  • It does not accept any parameter.

    它不接受任何參數。

Return value:

返回值:

The return type of the method is String, it returns the canonical (some authorised) denotations of the actions.

方法的返回類型為String ,它返回動作的規范(某些經授權)表示。

Example:

例:

// Java program to demonstrate the example 
// of String getActions() method 
// of FilePermission
import java.io.*;
public class GetActionsOfFP {
public static void main(String[] args) throws Exception {
FilePermission fp1 = null;
FilePermission fp2 = null;
try {
// Instantiates FilePermission fp1 , fp2 
fp1 = new FilePermission("D:\\includehelp.txt", "read");
fp2 = new FilePermission("D:\\includehelp.txt", "write");
// By using getActions() method is to return
// the action performed on the file of the 
// FilePermission
String action = fp1.getActions();
System.out.println("fp1.getActions(): " + action);
action = fp2.getActions();
System.out.println("fp2.getActions(): " + action);
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
}

Output

輸出量

fp1.getActions(): read
fp2.getActions(): write

翻譯自: https://www.includehelp.com/java/filepermission-getactions-method-with-example.aspx

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541953.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541953.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541953.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

字符與編碼(編碼轉換)

作為一名程序員,肯定有被亂碼困擾的時候,真到了百思不得其解的時候,就會覺得:英文程序員真幸福。但其實只要明白編碼之間的轉換規律,其實亂碼還是很好解決的。我們都知道字符串在保存和傳輸的時候需要先經過編碼成二進…

mysql 刷新二進制日志_使用binlog日志恢復MySQL數據庫刪除數據的方法

binlog日志簡介:binlog 就是binarylog,二進制日志文件,這個文件記錄了MySQL所有的DDL和DML(除了數據查詢語句)語句,以事件形式記錄,還包含語句所執行的消耗的時間。binlog日志包括兩類文件:1)二進制日志索引文件(文件名…

Java FileInputStream available()方法與示例

FileInputStream類的available()方法 (FileInputStream Class available() method) available() method is available in java.io package. available()方法在java.io包中可用。 available() method is used to return the number of bytes left that can be read from this Fi…

mysql 輸出參數 sql語句_MySQL: 詳細的sql語句

1添1.1【插入單行】insert [into] (列名) values (列值)例:insert into Strdents (姓名,性別,出生日期) values (開心朋朋,男,1980/6/15)1.2【將現有表數據添加到一個已有表】insert into (列名) select from 例:insert into tongxunlu (姓名,地址,電子郵…

執行git push出現Everything up-to-date

在github上git clone一個項目,在里面創建一個目錄,然后git push的時候,出現報錯"Everything up-to-date" 原因:1)沒有git add .2)沒有git commit -m "提交信息"如果上面兩個步驟都成功…

Java File類boolean delete()方法(帶示例)

文件類布爾型delete() (File Class boolean delete()) This method is available in package java.io.File.delete(). 軟件包java.io.File.delete()中提供了此方法。 This method is used to delete file or directory by using delete() method and this method is accessible…

Unity3D Adam Demo的學習與研究

1.簡述 這篇文章是對Adam各種相關資料了解后進行一些精簡的內容。如果你想仔細研究某個技術請跳轉至unity相關頁面。 Adam官方頁面: https://unity3d.com/cn/pages/adam 搬運視頻以及資源包網盤下載: http://pan.baidu.com/s/1jH6NF86 Adam這個demo由8個人的團隊耗時6個月(part…

Java File類boolean isFile()方法(帶示例)

File類boolean isFile() (File Class boolean isFile()) This method is available in package java.io.File.isFile(). 軟件包java.io.File.isFile()中提供了此方法。 This method is used to check whether the file is specified by filepath is a file or not. 此方法用于檢…

要加油!

現實中我容易佩服一個人。 一個頑強的女人,一個艱苦奮斗的男人..... 但是在網絡的世界里,我沒有佩服過幾個,但是不得不說的就是冰河。同樣的年齡人家做的事情和我們做的事情差距是多么的大,真的想想心里都是天壤之別。 比一比才知…

Java DataOutputStream writeInt()方法及示例

DataOutputStream類writeInt()方法 (DataOutputStream Class writeInt() method) writeInt() method is available in java.io package. writeInt()方法在java.io包中可用。 writeInt() method is used to write the given integer value to the basic DataOutputStream as 4 b…

python安卓自動化實現方法_uiautomator +python 實現安卓UI自動化

簡單實例注:安卓6.0以上的手機不會自動安裝app-uiautomator.apk和app-uiautomator-test.apk,需要手動安裝,否則報錯ioerror RPC server not starteduiautomator pythonHTMLTestRunner 安卓UI自動化實現#coding:utf-8from uiautomator importD…

ES6特性之:Spread操作符

Spread操作符(...),也稱作展開操作符,作用是將可迭代的(Iterable)對象進行展開。 比如有2個數組,我們要將其中一個數組中所有元素插入到另一個數組中,通過Spread操作符,就可以這樣進行: var fruits ["…

Java類class isMemberClass()方法及示例

類的類isMemberClass()方法 (Class class isMemberClass() method) isMemberClass() method is available in java.lang package. isMemberClass()方法在java.lang包中可用。 isMemberClass() method is used to check whether the underlying class is a member class or not.…

velocity自定義函數_velocity基本語法和總結

一:基本語法:1、#set(#a "a")$a ##輸出語句時直接寫變量的名稱即可2、判斷語句:#if($a "a") ##判斷語句沒有括號,也是直接輸出$a3、數組:#set($arry [0..10])$foreach($i in $arry)$i ##換行#e…

docker-machine指定cpu個數

序 給本機的一個服務壓測,結果半天qps上不了萬,而且經常跑滿cpu,搞半天發現,docker里頭才1核1G內存。原來boot2docker默認給docker-machine分配1個cpu和1G內存。 修改配置 docker-machine create \--driver virtualbox \--virtual…

Java ClassLoader findResources()方法與示例

ClassLoader類findResources()方法 (ClassLoader Class findResources() method) findResources() method is available in java.lang package. findResources()方法在java.lang包中可用。 findResources() method is used to find all the resources with the given resource …

Java ByteArrayInputStream mark()方法與示例

ByteArrayInputStream類mark()方法 (ByteArrayInputStream Class mark() method) mark() method is available in java.util package. mark()方法在java.util包中可用。 mark() method is used to set the current mark position in the stream from where read or write can b…

java mediainfo.dll_MediaInfo庫的簡單使用

想到一個問題, 如何獲得一個圖像文件(比如jpg, bmp, png)的信息. 自己查查文件的格式, 寫一個解析, 應該不困難; 但是找了下現成的, 發現MediaInfo庫已經可以非常好的實現需要的功能了.MediaInfo可以在sourceforge上找到, 是一個解析視頻,音頻, 圖片等媒體文件的庫. 可以得到文…

Redis配置和常用命令

1 redis.conf配置文件:2 引用3 #是否作為守護進程運行4 daemonize yes5 #配置pid的存放路徑及文件名,默認為當前路徑下6 pidfile redis.pid7 #Redis默認監聽端口8 port 63799 #客戶端閑置多少秒后,斷開連接 10 timeout 300 11 #日志顯示級別 …

oracle中dbms_DBMS中的功能依賴性和屬性關閉

oracle中dbms功能依賴 (Functional Dependency) A relational Database management System (RDBMS) represents the database o a collection of relations/tables. A functional dependency is a constraint between two sets of attributes in a relation. It is the propert…