001/** 002 * jshred - Shred's Toolbox 003 * 004 * Copyright (C) 2009 Richard "Shred" Körber 005 * http://jshred.shredzone.org 006 * 007 * This program is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License / GNU Lesser 009 * General Public License as published by the Free Software Foundation, 010 * either version 3 of the License, or (at your option) any later version. 011 * 012 * Licensed under the Apache License, Version 2.0 (the "License"); 013 * you may not use this file except in compliance with the License. 014 * 015 * This program is distributed in the hope that it will be useful, 016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 018 * 019 */ 020package net.shredzone.jshred.io; 021 022import java.io.FilterInputStream; 023import java.io.IOException; 024import java.io.InputStream; 025 026/** 027 * This is a {@link FilterInputStream} where the close() method is disabled. Use this 028 * class to pass an {@link InputStream} to another method, to make sure that the method is 029 * unable to close your stream unintentionally. 030 * 031 * @author Richard "Shred" Körber 032 * @since R13 033 */ 034public class UncloseableInputStream extends FilterInputStream { 035 036 /** 037 * Creates a new UncloseableInputStream. 038 * 039 * @param in 040 * {@link InputStream} which shall not be closed. 041 */ 042 public UncloseableInputStream(InputStream in) { 043 super(in); 044 } 045 046 /** 047 * Does not close the {@link InputStream}. 048 */ 049 @Override 050 public void close() throws IOException { 051 // do nothing... 052 } 053 054}