@Override public FileChannel open(String mode) throws IOException { return base.open(mode); }
/** * Open a random access file object. * This method is similar to Java 7 * <code>java.nio.channels.FileChannel.open</code>. * * @param fileName the file name * @param mode the access mode. Supported are r, rw, rws, rwd * @return the file object */ public static FileChannel open(String fileName, String mode) throws IOException { return FilePath.get(fileName).open(mode); }
private FileChannel getFileChannel() throws IOException { int id = (int) (filePointer / maxLength); while (id >= list.length) { int i = list.length; FileChannel[] newList = new FileChannel[i + 1]; System.arraycopy(list, 0, newList, 0, i); FilePath f = file.getBase(i); newList[i] = f.open(mode); list = newList; } return list[id]; }
@Override public FileChannel open(String mode) throws IOException { return new FileCache(getBase().open(mode)); }
/** * Create a new temporary file. * * @param suffix the suffix * @param deleteOnExit if the file should be deleted when the virtual * machine exists * @param inTempDir if the file should be stored in the temporary directory * @return the name of the created file */ public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { while (true) { FilePath p = getPath(name + getNextTempFileNamePart(false) + suffix); if (p.exists() || !p.createFile()) { // in theory, the random number could collide getNextTempFileNamePart(true); continue; } p.open("rw").close(); return p; } }
file = f.open(readOnly ? "r" : "rw"); if (encryptionKey != null) { byte[] key = FilePathEncrypt.getPasswordBytes(encryptionKey);