Package java.io

Examples of java.io.File.createNewFile()


       
        target.getFile().delete();
        File file = new File(filename);
       
        try {
            file.createNewFile();
       
            definition.setFile(file);
            settingsPanel.saveSettings(definition.getSettings(), false);
        } catch (IOException ie) {
            throw new WizardException(DcResources.getText("msgFileCannotBeUsed"));
View Full Code Here


       
        File file = new File(dir, "temp.txt");
        try {
       
            if (!file.exists())
                file.createNewFile();
           
            if (!file.exists() || !file.canWrite())
                throw new IOException("File cannot be created in directory " + dir);

        } catch (Throwable e) {
View Full Code Here

            queryFile.delete();
            queryFile = new File(DataCrow.dataDir, "data_crow_queries.txt");
        }

        try {
            queryFile.createNewFile();
            RandomAccessFile access  = new RandomAccessFile(queryFile, "rw");

            for (int i = 0; i < comboSQLCommands.getItemCount(); i++) {
                Object o = comboSQLCommands.getItemAt(i);
                if (o != null && o instanceof QueryObject) {
View Full Code Here

    public boolean createNewFile(String fileName) {
        fileName = translateFileName(fileName);
        File file = new File(fileName);
        for (int i = 0; i < SysProperties.MAX_FILE_RETRY; i++) {
            try {
                return file.createNewFile();
            } catch (IOException e) {
                // 'access denied' is really a concurrent access problem
                wait(i);
            }
        }
View Full Code Here

        ((FTPSClient) client).execPROT("P");
        assertTrue(getActiveSession().getDataConnection().isSecure());

        File file = new File(ROOT_DIR, "foo");
        file.createNewFile();

        InputStream is = null;
        try {
            is = client.retrieveFileStream(file.getName());
            assertEquals(-1, is.read(new byte[1024]));
View Full Code Here

        HTMLProfileReport report = new HTMLProfileReport(buildProfile);
        File file = new File(result.getGradle().getRootProject().getBuildDir(), "reports/profile/profile-"+
                FILE_DATE_FORMAT.format(new Date(profileStarted)) + ".html" );
        file.getParentFile().mkdirs();
        try {
            file.createNewFile();
            report.writeTo(file);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
View Full Code Here

        public DescriptorRAF(File baseFile, int cacheSize) throws IOException {
            String descName = baseFile.getName() + DESCRIPTOR_APPENDIX_RAF;
            File descFile = new File(baseFile.getParent(), descName);
            if(!descFile.exists()) {
                boolean created = descFile.createNewFile();
                if(!created) {
                    throw new IllegalStateException("create file failed: "
                            + descFile.getAbsolutePath());
                }
            }
View Full Code Here

            if ((recoverFlag == LogRecord.REDO) && (operationFlag == FILE_NEW_OPERATION) && (!existFlag)) {
                /* renew the file or recreate the directory */
                if (fileOrDirFlag == DIRECTORY_FLAG) {
                    file.mkdirs();
                } else {
                    file.createNewFile();
                }
            } else
            if (((recoverFlag == LogRecord.REDO) && (operationFlag == FILE_DELETE_OPERATION) && existFlag) || ((recoverFlag == LogRecord.UNDO) && (((operationFlag == FILE_NEW_OPERATION) && existFlag) || (operationFlag == FILE_DELETE_OPERATION) || (operationFlag == FILE_UPDATE_OPE_BYTE)))) {
                /* modified by marriane for close btree while delete
                directory or file */
 
View Full Code Here

        File path = new File(documentRoot, constructed);
        path.mkdirs();
        String identifier = System.currentTimeMillis() + "_" + StringUtils.getFilename(document.getIdentifier());
        document.setUri(constructed + "/" + identifier);
        path = new File(path, identifier);
        path.createNewFile();
        return new FileOutputStream(path);
    }

    public boolean delete(String uri) {
        Assert.hasText(uri);
View Full Code Here

            boolean status = testCaseList.delete();
            assert (status) : "delete file failed: " + testCaseList.getAbsolutePath();
        }
        testCaseList = new File(testResourceDir, "TestCase.list");
        assert (!testCaseList.exists());
        boolean created = testCaseList.createNewFile();
        assert (created) : "File creation failed: " + testCaseList.getAbsolutePath();
    }

    private static void generate() throws Exception {
        final Document catalog = XQTSTestBase.catalogPool.borrowObject();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.