/** * Creates this entry as a directory in the associated <code>AbstractArchiveFile</code>. * <p> * Throws a {@link UnsupportedFileOperationException} if if the underlying file does not support the required * read and write {@link FileOperation file operations}. Throws an <code>IOException</code> if this entry * already exists in the archive or if an I/O error occurred. * </p> * * @throws IOException if this entry already exists in the archive or if an I/O error occurred. * @throws UnsupportedFileOperationException if the underlying archive file does not support the required read and * write {@link FileOperation file operations}. */ @Override public void mkdir() throws IOException, UnsupportedFileOperationException { if(entry.exists()) throw new IOException(); AbstractRWArchiveFile rwArchivefile = (AbstractRWArchiveFile)archiveFile; // Update the ArchiveEntry entry.setDirectory(true); entry.setDate(System.currentTimeMillis()); entry.setSize(0); // Add the entry to the archive file rwArchivefile.addEntry(entry); // The entry now exists entry.setExists(true); }
/** * Creates a new ArchiveEntry using the values of the supplied attributes. * * @param path the entry's path * @param directory true if the entry is a directory * @param date the entry's date * @param size the entry's size * @param exists <code>true</code> if the entry exists in the archive */ public ArchiveEntry(String path, boolean directory, long date, long size, boolean exists) { setPath(path); setDate(date); setSize(size); setDirectory(directory); setExists(exists); }
entry.setDirectory(false); entry.setSize(0); entry.setExists(false);