001 /*
002 * Java GPX Library (jpx-3.1.0).
003 * Copyright (c) 2016-2023 Franz Wilhelmstötter
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 * Author:
018 * Franz Wilhelmstötter (franz.wilhelmstoetter@gmail.com)
019 */
020 package io.jenetics.jpx;
021
022 import static java.util.Objects.requireNonNull;
023
024 import java.io.IOException;
025 import java.io.InputStream;
026 import java.io.OutputStream;
027
028 /**
029 * @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
030 * @version 3.0
031 * @since 3.0
032 */
033 final class NonCloseableInputStream extends InputStream {
034
035 private final InputStream _input;
036
037 NonCloseableInputStream(final InputStream input) {
038 _input = requireNonNull(input);
039 }
040
041 @Override
042 public int read() throws IOException {
043 return _input.read();
044 }
045
046 @Override
047 public int read(byte[] b) throws IOException {
048 return _input.read(b);
049 }
050
051 @Override
052 public int read(byte[] b, int off, int len) throws IOException {
053 return _input.read(b, off, len);
054 }
055
056 @Override
057 public byte[] readAllBytes() throws IOException {
058 return _input.readAllBytes();
059 }
060
061 @Override
062 public byte[] readNBytes(int len) throws IOException {
063 return _input.readNBytes(len);
064 }
065
066 @Override
067 public int readNBytes(byte[] b, int off, int len) throws IOException {
068 return _input.readNBytes(b, off, len);
069 }
070
071 @Override
072 public long skip(long n) throws IOException {
073 return _input.skip(n);
074 }
075
076 @Override
077 public void skipNBytes(long n) throws IOException {
078 _input.skipNBytes(n);
079 }
080
081 @Override
082 public int available() throws IOException {
083 return _input.available();
084 }
085
086 @Override
087 public void close() {
088 }
089
090 @Override
091 public void mark(int readlimit) {
092 _input.mark(readlimit);
093 }
094
095 @Override
096 public void reset() throws IOException {
097 _input.reset();
098 }
099
100 @Override
101 public boolean markSupported() {
102 return _input.markSupported();
103 }
104
105 @Override
106 public long transferTo(OutputStream out) throws IOException {
107 return _input.transferTo(out);
108 }
109
110 }
|