1 /*
2 * Copyright (C) 2018, David Pursehouse <david.pursehouse@gmail.com> and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 package org.eclipse.jgit.util.io;
12
13 import java.io.File;
14 import java.io.FileInputStream;
15 import java.io.FileNotFoundException;
16 import java.io.IOException;
17
18 /**
19 * An implementation of FileInputStream that ignores any exceptions on close().
20 *
21 * @since 5.0
22 */
23 public class SilentFileInputStream extends FileInputStream {
24 /**
25 * @param file
26 * the file
27 * @throws FileNotFoundException
28 * the file was not found
29 */
30 public SilentFileInputStream(File file) throws FileNotFoundException {
31 super(file);
32 }
33
34 @Override
35 public void close() {
36 try {
37 super.close();
38 } catch (IOException e) {
39 // Ignore
40 }
41 }
42 }