001package com.avpkit.ferry; 002 003import java.io.File; 004import java.io.IOException; 005 006/** 007 * 008 * @author ayache 009 */ 010public interface ITempFileCreator { 011 012 File createTempFile(String prefix, String suffix, File directory) throws IOException; 013 014 static class DefaultTempFileCreator implements ITempFileCreator{ 015 016 @Override 017 public File createTempFile(String prefix, String suffix, File directory) throws IOException { 018 return File.createTempFile(prefix, suffix, directory); 019 } 020 021 } 022 023 static final class Builder{ 024 private static ITempFileCreator CREATOR = new DefaultTempFileCreator(); 025 026 static synchronized ITempFileCreator getDefault(){ 027 return CREATOR; 028 } 029 030 public static synchronized void setDefault(ITempFileCreator creator){ 031 CREATOR = creator; 032 } 033 } 034}