public Java6FileApiPermissionsStrategy() throws ZipException { canExecuteMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "canExecute"); setExecutableMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "setExecutable", boolean.class, boolean.class); setReadableMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "setReadable", boolean.class, boolean.class); setWritableMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "setWritable", boolean.class, boolean.class); }
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"); } }
pathClass = ZTZipReflectionUtil.getClassForName("java.nio.file.Path", Object.class); toPathMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "toPath"); setPosixFilePermissionsMethod = ZTZipReflectionUtil.getDeclaredMethod(filesClass, "setPosixFilePermissions", pathClass, Set.class); getPosixFilePermissionsMethod = ZTZipReflectionUtil.getDeclaredMethod(filesClass, "getPosixFilePermissions", pathClass, linkOptionsArray.getClass());
public Java6FileApiPermissionsStrategy() throws ZipException { canExecuteMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "canExecute"); setExecutableMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "setExecutable", boolean.class, boolean.class); setReadableMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "setReadable", boolean.class, boolean.class); setWritableMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "setWritable", boolean.class, boolean.class); }
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"); } }
pathClass = ZTZipReflectionUtil.getClassForName("java.nio.file.Path", Object.class); toPathMethod = ZTZipReflectionUtil.getDeclaredMethod(File.class, "toPath"); setPosixFilePermissionsMethod = ZTZipReflectionUtil.getDeclaredMethod(filesClass, "setPosixFilePermissions", pathClass, Set.class); getPosixFilePermissionsMethod = ZTZipReflectionUtil.getDeclaredMethod(filesClass, "getPosixFilePermissions", pathClass, linkOptionsArray.getClass());