本文整理汇总了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);
}
}