本文整理了Java中org.apache.hadoop.fs.FileUtil.setWritable()
方法的一些代码示例,展示了FileUtil.setWritable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.setWritable()
方法的具体详情如下:
包路径:org.apache.hadoop.fs.FileUtil
类名称:FileUtil
方法名:setWritable
[英]Platform independent implementation for File#setWritable(boolean)File#setWritable does not work as expected on Windows.
[中]文件#可设置可写(布尔)文件#可设置可写的平台独立实现在Windows上无法按预期工作。
代码示例来源:origin: org.apache.hadoop/hadoop-common
private static void grantPermissions(final File f) {
FileUtil.setExecutable(f, true);
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
}
代码示例来源:origin: io.hops/hadoop-common
private static void grantPermissions(final File f) {
FileUtil.setExecutable(f, true);
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
private static void grantPermissions(final File f) {
FileUtil.setExecutable(f, true);
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
private static void grantPermissions(final File f) {
FileUtil.setExecutable(f, true);
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
private static void grantPermissions(final File f) {
FileUtil.setExecutable(f, true);
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
public TemporarySocketDirectory() {
String tmp = System.getProperty("java.io.tmpdir", "/tmp");
dir = new File(tmp, "socks." + (System.currentTimeMillis() +
"." + (new Random().nextInt())));
dir.mkdirs();
FileUtil.setWritable(dir, true);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
public TemporarySocketDirectory() {
String tmp = System.getProperty("java.io.tmpdir", "/tmp");
dir = new File(tmp, "socks." + (System.currentTimeMillis() +
"." + (new Random().nextInt())));
dir.mkdirs();
FileUtil.setWritable(dir, true);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
@After
public void tearDown() throws Exception {
if(data_fail != null) {
FileUtil.setWritable(data_fail, true);
}
if(failedDir != null) {
FileUtil.setWritable(failedDir, true);
}
if(cluster != null) {
cluster.shutdown();
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
private static void grantPermissions(final File f) {
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
FileUtil.setExecutable(f, true);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
private static void revokePermissions(final File f) {
FileUtil.setWritable(f, false);
FileUtil.setExecutable(f, false);
FileUtil.setReadable(f, false);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
private static void revokePermissions(final File f) {
FileUtil.setWritable(f, false);
FileUtil.setExecutable(f, false);
FileUtil.setReadable(f, false);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
private static void grantPermissions(final File f) {
FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true);
FileUtil.setExecutable(f, true);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@After
public void cleanUp() throws IOException {
FileUtil.setWritable(base, true);
FileUtil.fullyDelete(base);
assertTrue(!base.exists());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@After
public void after() throws IOException {
FileUtil.setWritable(base, true);
FileUtil.fullyDelete(base);
assertTrue(!base.exists());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@After
public void cleanUp() throws IOException {
FileUtil.setWritable(base, true);
FileUtil.fullyDelete(base);
assertTrue(!base.exists());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@After
public void after() throws IOException {
FileUtil.setWritable(test_root, true);
FileUtil.fullyDelete(test_root);
assertTrue(!test_root.exists());
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@After
public void after() throws IOException {
FileUtil.setWritable(test_root, true);
FileUtil.fullyDelete(test_root);
assertTrue(!test_root.exists());
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@After
public void after() throws IOException {
FileUtil.setWritable(base, true);
FileUtil.fullyDelete(base);
assertTrue(!base.exists());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
@Test
public void testFailedOpen() throws Exception {
File logDir = new File(TEST_DIR, "testFailedOpen");
logDir.mkdirs();
FSEditLog log = FSImageTestUtil.createStandaloneEditLog(logDir);
try {
FileUtil.setWritable(logDir, false);
log.openForWrite();
fail("Did no throw exception on only having a bad dir");
} catch (IOException ioe) {
GenericTestUtils.assertExceptionContains(
"too few journals successfully started", ioe);
} finally {
FileUtil.setWritable(logDir, true);
log.close();
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
@Test
public void testFailToRename() throws IOException {
assumeTrue(Shell.WINDOWS);
OutputStream fos = null;
try {
fos = new AtomicFileOutputStream(DST_FILE);
fos.write(TEST_STRING.getBytes());
FileUtil.setWritable(TEST_DIR, false);
exception.expect(IOException.class);
exception.expectMessage("failure in native rename");
try {
fos.close();
} finally {
fos = null;
}
} finally {
IOUtils.cleanup(null, fos);
FileUtil.setWritable(TEST_DIR, true);
}
}
内容来源于网络,如有侵权,请联系作者删除!