1 /* 2 * dpkg - Debian Package library and the Debian Package Maven plugin 3 * (c) Copyright 2015 Gerrit Hohl 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 package net.sourceforge.javadpkg.io; 20 21 import java.io.Closeable; 22 import java.io.IOException; 23 import java.io.OutputStream; 24 25 /** 26 * <p> 27 * The target for writing data. 28 * </p> 29 * 30 * @author Gerrit Hohl (gerrit-hohl@users.sourceforge.net) 31 * @version <b>1.0</b>, 31.12.2015 by Gerrit Hohl 32 */ 33 public interface DataTarget extends Closeable { 34 35 36 /** 37 * <p> 38 * Returns the name of the source. 39 * </p> 40 * <p> 41 * This name is used e.g. for detail messages of exceptions. 42 * </p> 43 * 44 * @return The name. 45 */ 46 String getName(); 47 48 49 /** 50 * <p> 51 * Returns a stream for writing the data. 52 * </p> 53 * <p> 54 * The method will always return the same {@link OutputStream} if the source 55 * is still open. If the {@link OutputStream#close()} method is called the 56 * source will behave the same as the {@link #close()} method was called. 57 * </p> 58 * 59 * @return The stream. 60 * @throws IOException 61 * If an I/O error occurs. 62 */ 63 OutputStream getOutputStream() throws IOException; 64 65 66 }