Java Temp File Create getTempFileWithFullPath()

Here you can find the source of getTempFileWithFullPath()

Description

get Temp File With Full Path

License

Open Source License

Declaration

public static List<String> getTempFileWithFullPath() throws IOException 

Method Source Code


//package com.java2s;
/*//from   ww  w  .ja v  a2s. c  o  m
 * Copyright (c) 2014 Mastek Ltd. All rights reserved.
 * 
 * This file is part of JBEAM. JBEAM is free software: you can
 * redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation.
 *
 * JBEAM is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
 * Public License for the specific language governing permissions and 
 * limitations.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with JBEAM. If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> getTempFileWithFullPath() throws IOException {
        File file = File.createTempFile("OnlineReport", ".pdf");
        List<String> fileDetails = new ArrayList<String>(2);
        fileDetails.add(file.getParentFile().getAbsolutePath().replace("\\", "/"));
        fileDetails.add(file.getName());
        file.delete();
        return fileDetails;
    }
}

Related

  1. getTempFileName(String base, String ext)
  2. getTempFileName(String fileExt)
  3. getTempFilePath(String name)
  4. getTempFilePath(String signatureRequestId)
  5. getTempFiles()
  6. getUniqueAFileName(String ext)
  7. getUniqueFile(File dir, String prefix, String suffix)
  8. getUniqueFileName()
  9. getUniqueFilename(String filename, String extension)