Cleanup imports/whitespace in MD-SAL
[controller.git] / opendaylight / md-sal / sal-netconf-connector / src / main / java / org / opendaylight / controller / sal / connect / netconf / YangModelInputStreamAdapter.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.sal.connect.netconf;
9
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.io.StringBufferInputStream;
13
14 import org.opendaylight.yangtools.concepts.Delegator;
15 import org.opendaylight.yangtools.yang.common.QName;
16
17 /**
18  *
19  *
20  */
21 public class YangModelInputStreamAdapter extends InputStream implements Delegator<InputStream> {
22
23     final String source;
24     final QName moduleIdentifier;
25     final InputStream delegate;
26
27
28
29     private YangModelInputStreamAdapter(String source, QName moduleIdentifier, InputStream delegate) {
30         super();
31         this.source = source;
32         this.moduleIdentifier = moduleIdentifier;
33         this.delegate = delegate;
34     }
35
36     @Override
37     public int read() throws IOException {
38         return delegate.read();
39     }
40
41     @Override
42     public int hashCode() {
43         return delegate.hashCode();
44     }
45
46     @Override
47     public int read(byte[] b) throws IOException {
48         return delegate.read(b);
49     }
50
51     @Override
52     public boolean equals(Object obj) {
53         return delegate.equals(obj);
54     }
55
56     @Override
57     public int read(byte[] b, int off, int len) throws IOException {
58         return delegate.read(b, off, len);
59     }
60
61     @Override
62     public long skip(long n) throws IOException {
63         return delegate.skip(n);
64     }
65
66     @Override
67     public int available() throws IOException {
68         return delegate.available();
69     }
70
71     @Override
72     public void close() throws IOException {
73         delegate.close();
74     }
75
76     @Override
77     public void mark(int readlimit) {
78         delegate.mark(readlimit);
79     }
80
81     @Override
82     public void reset() throws IOException {
83         delegate.reset();
84     }
85
86     @Override
87     public boolean markSupported() {
88         return delegate.markSupported();
89     }
90
91     @Override
92     public InputStream getDelegate() {
93         return delegate;
94     }
95
96     @Override
97     public String toString() {
98         return "YangModelInputStreamAdapter [moduleIdentifier=" + moduleIdentifier + ", delegate=" + delegate + "]";
99     }
100
101     public static YangModelInputStreamAdapter create(QName name, String module) {
102         InputStream stringInput = new StringBufferInputStream(module);
103         return new YangModelInputStreamAdapter(null, name, stringInput );
104     }
105 }