本文整理匯總了Java中com.intellij.openapi.util.io.FileUtil.setReadOnlyAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.setReadOnlyAttribute方法的具體用法?Java FileUtil.setReadOnlyAttribute怎麽用?Java FileUtil.setReadOnlyAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.setReadOnlyAttribute方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeOption
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static void writeOption(String option, int value, Pattern pattern) {
File file = getWriteFile();
if (file == null) return;
try {
String optionValue = option + value + "m";
String content = read();
if (content == null) content = "";
content = replace(pattern, content, optionValue, "", "", content + " " + optionValue);
if (file.exists()) {
FileUtil.setReadOnlyAttribute(file.getPath(), false);
}
@SuppressWarnings("SSBasedInspection") byte[] bytes = content.getBytes();
FileUtil.writeToFile(file, bytes);
}
catch (IOException e) {
LOG.info(e);
}
}
示例2: setWritable
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public void setWritable(@NotNull final VirtualFile file, final boolean writableFlag) throws IOException {
FileUtil.setReadOnlyAttribute(file.getPath(), !writableFlag);
final File ioFile = convertToIOFile(file);
if (ioFile.canWrite() != writableFlag) {
throw new IOException("Failed to change read-only flag for " + ioFile.getPath());
}
}
示例3: testWritingReadOnlyFile
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Test
public void testWritingReadOnlyFile() {
FileUtil.setReadOnlyAttribute(myFile.getPath(), true);
VMOptions.writeXmx(1024);
VMOptions.writeMaxPermGen(256);
assertEquals("-Xmx1024m\n" +
"-XX:MaxPermSize=256m",
readFile());
}
示例4: setReadOnlyAttribute
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public static void setReadOnlyAttribute(String path, boolean readOnlyStatus) throws IOException {
FileUtil.setReadOnlyAttribute(path, readOnlyStatus);
}
示例5: unlockFiles
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static void unlockFiles(final List<File> files) throws IOException {
for (File file : files) {
FileUtil.setReadOnlyAttribute(file.getAbsolutePath(), false);
}
}