@Test public void testMkfile() throws IOException { tempFile.mkfile(); assert tempFile.exists(); boolean ioExceptionThrown = false; try { tempFile.mkfile(); } catch(IOException e) { ioExceptionThrown = true; } assert ioExceptionThrown; tempFile.delete(); tempFile.mkdir(); ioExceptionThrown = false; try { tempFile.mkfile(); } catch(IOException e) { ioExceptionThrown = true; } assert ioExceptionThrown; }
public void mkfile() throws IOException, UnsupportedFileOperationException { if(exists()) throw new IOException(); if(isFileOperationSupported(FileOperation.WRITE_FILE)) getOutputStream().close(); else copyStream(new ByteArrayInputStream(new byte[]{}), false, 0); }
AbstractFile implements FileAttributes { public void mkfile() throws IOException, UnsupportedFileOperationException { if(exists()) throw new IOException(); if(isFileOperationSupported(FileOperation.WRITE_FILE)) getOutputStream().close(); else copyStream(new ByteArrayInputStream(new byte[]{}), false, 0); } }
AbstractFile implements FileAttributes { public void mkfile() throws IOException, UnsupportedFileOperationException { if(exists()) throw new IOException(); if(isFileOperationSupported(FileOperation.WRITE_FILE)) getOutputStream().close(); else copyStream(new ByteArrayInputStream(new byte[]{}), false, 0); } protected  AbstractFile(FileURL url); }
AbstractFile implements FileAttributes { public void mkfile() throws IOException, UnsupportedFileOperationException { if(exists()) throw new IOException(); if(isFileOperationSupported(FileOperation.WRITE_FILE)) getOutputStream().close(); else copyStream(new ByteArrayInputStream(new byte[]{}), false, 0); } protected  AbstractFile(FileURL url); FileURL getURL(); URL getJavaNetURL(); String getName(); String getExtension(); String getAbsolutePath(); String getCanonicalPath(); AbstractFile getCanonicalFile(); String getSeparator(); boolean isHidden(); boolean canRead(); AbstractFile getRoot(); boolean isRoot(); AbstractFile getVolume(); InputStream getInputStream(long offset); void copyStream(InputStream in, boolean append, long length); final void copyTo(AbstractFile destFile); final void moveTo(AbstractFile destFile); void mkfile(); AbstractFile[] ls(FileFilter filter); AbstractFile[] ls(FilenameFilter filter); void changePermissions(int permissions); String getPermissionsString(); void deleteRecursively(); boolean isFileOperationSupported(FileOperation op); final boolean isBrowsable(); final String getNameWithoutExtension(); final String getPath(); final String getAbsolutePath(boolean appendSeparator); final String getCanonicalPath(boolean appendSeparator); final AbstractFile getChild(String relativePath); AbstractFile getChild(String relativePath, AbstractFile template); final AbstractFile getChildSilently(String relativePath); final AbstractFile getDirectChild(String filename); final AbstractFile getDirectChild(String filename, AbstractFile template); final void mkdir(String name); final void mkdirs(); final void mkfile(String name); final AbstractFile getAncestor(); final T getAncestor(Class<T> abstractFileClass); final AbstractFile getTopAncestor(); final boolean hasAncestor(); final boolean hasAncestor(Class<? extends AbstractFile> abstractFileClass); final boolean isParentOf(AbstractFile file); final AbstractArchiveFile getParentArchive(); final Icon getIcon(Dimension preferredResolution); final Icon getIcon(); final String calculateChecksum(String algorithm); final String calculateChecksum(MessageDigest messageDigest); final String addTrailingSeparator(String path); final void changePermissions(FilePermissions permissions); final void importPermissions(AbstractFile sourceFile); final void importPermissions(AbstractFile sourceFile, FilePermissions defaultPermissions); static boolean isFileOperationSupported(FileOperation op, Class<? extends AbstractFile> c); static String getExtension(String filename); String getBaseName(); static String calculateChecksum(InputStream in, MessageDigest messageDigest); boolean equals(Object o); boolean equalsCanonical(Object o); int hashCode(); String toString(); abstract long getDate(); abstract void changeDate(long lastModified); abstract long getSize(); abstract AbstractFile getParent(); abstract void setParent(AbstractFile parent); abstract boolean exists(); abstract FilePermissions getPermissions(); abstract PermissionBits getChangeablePermissions(); abstract void changePermission(PermissionAccess access, PermissionType permission, boolean enabled); abstract String getOwner(); abstract boolean canGetOwner(); abstract String getGroup(); abstract boolean canGetGroup(); abstract boolean isDirectory(); abstract boolean isArchive(); abstract boolean isSymlink(); abstract boolean isSystem(); abstract AbstractFile[] ls(); abstract void mkdir(); abstract InputStream getInputStream(); abstract OutputStream getOutputStream(); abstract OutputStream getAppendOutputStream(); abstract RandomAccessInputStream getRandomAccessInputStream(); abstract RandomAccessOutputStream getRandomAccessOutputStream(); abstract void delete(); abstract void renameTo(AbstractFile destFile); abstract void copyRemotelyTo(AbstractFile destFile); abstract long getFreeSpace(); abstract long getTotalSpace(); abstract Object getUnderlyingFileObject(); String getCustomExtension(); void setCustomExtension(String customExtension); }
AbstractFile implements FileAttributes { public void mkfile() throws IOException, UnsupportedFileOperationException { if(exists()) throw new IOException(); if(isFileOperationSupported(FileOperation.WRITE_FILE)) getOutputStream().close(); else copyStream(new ByteArrayInputStream(new byte[]{}), false, 0); } protected  AbstractFile(FileURL url); FileURL getURL(); URL getJavaNetURL(); String getName(); String getExtension(); String getAbsolutePath(); String getCanonicalPath(); AbstractFile getCanonicalFile(); String getSeparator(); boolean isHidden(); boolean canRead(); AbstractFile getRoot(); boolean isRoot(); AbstractFile getVolume(); InputStream getInputStream(long offset); void copyStream(InputStream in, boolean append, long length); final void copyTo(AbstractFile destFile); final void moveTo(AbstractFile destFile); void mkfile(); AbstractFile[] ls(FileFilter filter); AbstractFile[] ls(FilenameFilter filter); void changePermissions(int permissions); String getPermissionsString(); void deleteRecursively(); boolean isFileOperationSupported(FileOperation op); final boolean isBrowsable(); final String getNameWithoutExtension(); final String getPath(); final String getAbsolutePath(boolean appendSeparator); final String getCanonicalPath(boolean appendSeparator); final AbstractFile getChild(String relativePath); AbstractFile getChild(String relativePath, AbstractFile template); final AbstractFile getChildSilently(String relativePath); final AbstractFile getDirectChild(String filename); final AbstractFile getDirectChild(String filename, AbstractFile template); final void mkdir(String name); final void mkdirs(); final void mkfile(String name); final AbstractFile getAncestor(); final T getAncestor(Class<T> abstractFileClass); final AbstractFile getTopAncestor(); final boolean hasAncestor(); final boolean hasAncestor(Class<? extends AbstractFile> abstractFileClass); final boolean isParentOf(AbstractFile file); final AbstractArchiveFile getParentArchive(); final Icon getIcon(Dimension preferredResolution); final Icon getIcon(); final String calculateChecksum(String algorithm); final String calculateChecksum(MessageDigest messageDigest); final String addTrailingSeparator(String path); final void changePermissions(FilePermissions permissions); final void importPermissions(AbstractFile sourceFile); final void importPermissions(AbstractFile sourceFile, FilePermissions defaultPermissions); static boolean isFileOperationSupported(FileOperation op, Class<? extends AbstractFile> c); static String getExtension(String filename); String getBaseName(); static String calculateChecksum(InputStream in, MessageDigest messageDigest); boolean equals(Object o); boolean equalsCanonical(Object o); int hashCode(); String toString(); abstract long getDate(); abstract void changeDate(long lastModified); abstract long getSize(); abstract AbstractFile getParent(); abstract void setParent(AbstractFile parent); abstract boolean exists(); abstract FilePermissions getPermissions(); abstract PermissionBits getChangeablePermissions(); abstract void changePermission(PermissionAccess access, PermissionType permission, boolean enabled); abstract String getOwner(); abstract boolean canGetOwner(); abstract String getGroup(); abstract boolean canGetGroup(); abstract boolean isDirectory(); abstract boolean isArchive(); abstract boolean isSymlink(); abstract boolean isSystem(); abstract AbstractFile[] ls(); abstract void mkdir(); abstract InputStream getInputStream(); abstract OutputStream getOutputStream(); abstract OutputStream getAppendOutputStream(); abstract RandomAccessInputStream getRandomAccessInputStream(); abstract RandomAccessOutputStream getRandomAccessOutputStream(); abstract void delete(); abstract void renameTo(AbstractFile destFile); abstract void copyRemotelyTo(AbstractFile destFile); abstract long getFreeSpace(); abstract long getTotalSpace(); abstract Object getUnderlyingFileObject(); String getCustomExtension(); void setCustomExtension(String customExtension); final static String DEFAULT_SEPARATOR; final static int IO_BUFFER_SIZE; }