This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.io;
020
021import org.apache.reef.annotations.Provided;
022import org.apache.reef.tang.annotations.DefaultImplementation;
023
024import java.io.File;
025import java.io.IOException;
026import java.nio.file.attribute.FileAttribute;
027
028/**
029 * Utility to create temporary files and folders in accordance with the underlying resource manager.
030 */
031@Provided
032@DefaultImplementation(WorkingDirectoryTempFileCreator.class)
033public interface TempFileCreator {
034  /**
035   * Creates a temporary file.
036   *
037   * @param prefix the prefix for the file
038   * @param suffix the suffix for the file
039   * @return the created file.
040   * @throws IOException
041   */
042  File createTempFile(final String prefix, final String suffix) throws IOException;
043
044  /**
045   * Creates a temporary folder.
046   *
047   * @param prefix the prefix for the file
048   * @param attrs the attributes for the file
049   * @return the created folder.
050   * @throws IOException
051   */
052  File createTempDirectory(final String prefix, final FileAttribute<?> attrs) throws IOException;
053
054
055  /**
056   * Create a temporary folder.
057   *
058   * @param prefix the prefix for the folder
059   * @return the created folder
060   * @throws IOException
061   */
062  File createTempDirectory(final String prefix) throws IOException;
063
064
065}