/** * Construct java.nio.file.Path object from abstract path. * Invokes JDK7 <code>file.toPath()</code> method through reflection. * * @param file * @return instance of java.nio.file.Path object */ private Object toPath(File file) { return ZTZipReflectionUtil.invoke(toPathMethod, file); }
private boolean setExecutable(File file, boolean executable, boolean ownerOnly) { return (Boolean) ZTZipReflectionUtil.invoke(setExecutableMethod, file, executable, ownerOnly); }
private boolean setWritable(File file, boolean executable, boolean ownerOnly) { return (Boolean) ZTZipReflectionUtil.invoke(setWritableMethod, file, executable, ownerOnly); }
private boolean canExecute(File file) { return (Boolean) ZTZipReflectionUtil.invoke(canExecuteMethod, file); } }
private boolean setReadable(File file, boolean executable, boolean ownerOnly) { return (Boolean) ZTZipReflectionUtil.invoke(setReadableMethod, file, executable, ownerOnly); }
private Set<?> getPosixFilePermissions(File file) { return (Set<?>) ZTZipReflectionUtil.invoke(getPosixFilePermissionsMethod, null, toPath(file), linkOptionsArray); }
private void setPosixFilePermissions(File file, Set<?> set) { ZTZipReflectionUtil.invoke(setPosixFilePermissionsMethod, null, toPath(file), set); }
private static boolean isPosix() { Method getDefaultMethod = ZTZipReflectionUtil.getDeclaredMethod( ZTZipReflectionUtil.getClassForName("java.nio.file.FileSystems", Object.class), "getDefault"); Method supportedFileAttributeViewsMethod = ZTZipReflectionUtil.getDeclaredMethod( ZTZipReflectionUtil.getClassForName("java.nio.file.FileSystem", Object.class), "supportedFileAttributeViews"); Object fileSystem = ZTZipReflectionUtil.invoke(getDefaultMethod, null); @SuppressWarnings("unchecked") Set<String> views = (Set<String>) ZTZipReflectionUtil.invoke(supportedFileAttributeViewsMethod, fileSystem); return views.contains("posix"); } }
/** * Construct java.nio.file.Path object from abstract path. * Invokes JDK7 <code>file.toPath()</code> method through reflection. * * @param file * @return instance of java.nio.file.Path object */ private Object toPath(File file) { return ZTZipReflectionUtil.invoke(toPathMethod, file); }
private boolean canExecute(File file) { return (Boolean) ZTZipReflectionUtil.invoke(canExecuteMethod, file); } }
private boolean setWritable(File file, boolean executable, boolean ownerOnly) { return (Boolean) ZTZipReflectionUtil.invoke(setWritableMethod, file, executable, ownerOnly); }
private boolean setReadable(File file, boolean executable, boolean ownerOnly) { return (Boolean) ZTZipReflectionUtil.invoke(setReadableMethod, file, executable, ownerOnly); }
private boolean setExecutable(File file, boolean executable, boolean ownerOnly) { return (Boolean) ZTZipReflectionUtil.invoke(setExecutableMethod, file, executable, ownerOnly); }
private Set<?> getPosixFilePermissions(File file) { return (Set<?>) ZTZipReflectionUtil.invoke(getPosixFilePermissionsMethod, null, toPath(file), linkOptionsArray); }
private void setPosixFilePermissions(File file, Set<?> set) { ZTZipReflectionUtil.invoke(setPosixFilePermissionsMethod, null, toPath(file), set); }
private static boolean isPosix() { Method getDefaultMethod = ZTZipReflectionUtil.getDeclaredMethod( ZTZipReflectionUtil.getClassForName("java.nio.file.FileSystems", Object.class), "getDefault"); Method supportedFileAttributeViewsMethod = ZTZipReflectionUtil.getDeclaredMethod( ZTZipReflectionUtil.getClassForName("java.nio.file.FileSystem", Object.class), "supportedFileAttributeViews"); Object fileSystem = ZTZipReflectionUtil.invoke(getDefaultMethod, null); @SuppressWarnings("unchecked") Set<String> views = (Set<String>) ZTZipReflectionUtil.invoke(supportedFileAttributeViewsMethod, fileSystem); return views.contains("posix"); } }