1/**************************************************************** 2 * Licensed to the Apache Software Foundation (ASF) under one * 3 * or more contributor license agreements. See the NOTICE file * 4 * distributed with this work for additional information * 5 * regarding copyright ownership. The ASF licenses this file * 6 * to you under the Apache License, Version 2.0 (the * 7 * "License"); you may not use this file except in compliance * 8 * with the License. You may obtain a copy of the License at * 9 * * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, * 13 * software distributed under the License is distributed on an * 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * 15 * KIND, either express or implied. See the License for the * 16 * specific language governing permissions and limitations * 17 * under the License. * 18 ****************************************************************/ 19 20package org.apache.james.mime4j.util; 21 22import java.io.IOException; 23 24/** 25 * 26 * @version $Id: TempPath.java,v 1.2 2004/10/02 12:41:11 ntherning Exp $ 27 */ 28public interface TempPath { 29 TempPath createTempPath() throws IOException; 30 TempPath createTempPath(String prefix) throws IOException; 31 32 /** 33 * Creates a new temporary file. Wheter it will be be created in memory 34 * or on disk is up to to the implementation. 35 * The prefix will be empty and the suffix will be 36 * <code>.tmp</code> if created on disk. 37 * 38 * @return the temporary file. 39 */ 40 TempFile createTempFile() throws IOException; 41 42 /** 43 * Creates a new temporary file. Wheter it will be be created in memory 44 * or on disk is up to to the implementation. 45 * The prefix and suffix can be set by the user. 46 * 47 * @param prefix the prefix to use. <code>null</code> gives no prefix. 48 * @param suffix the suffix to use. <code>null</code> gives 49 * <code>.tmp</code>. 50 * @return the temporary file. 51 */ 52 TempFile createTempFile(String prefix, String suffix) throws IOException; 53 54 /** 55 * Creates a new temporary file. Wheter it will be be created in memory 56 * or on disk can be specified using the <code>allowInMemory</code> 57 * parameter. If the implementation doesn't support in-memory files 58 * the new file will be created on disk. 59 * The prefix and suffix can be set by the user. 60 * 61 * @param prefix the prefix to use. <code>null</code> gives no prefix. 62 * @param suffix the suffix to use. <code>null</code> gives 63 * <code>.tmp</code>. 64 * @param allowInMemory if <code>true</code> the file MIGHT be created in 65 * memory if supported by the implentation. If <code>false</code> the 66 * file MUST be created on disk. 67 * @return the temporary file. 68 */ 69 TempFile createTempFile(String prefix, String suffix, 70 boolean allowInMemory) throws IOException; 71 String getAbsolutePath(); 72 void delete(); 73} 74