Fixed advanced Netconf client functionality.
[controller.git] / opendaylight / md-sal / sal-netconf-connector / src / main / java / org / opendaylight / controller / sal / connect / netconf / YangModelInputStreamAdapter.java
1 package org.opendaylight.controller.sal.connect.netconf;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.io.StringBufferInputStream;
6 import java.io.StringReader;
7
8 import org.opendaylight.yangtools.concepts.Delegator;
9 import org.opendaylight.yangtools.yang.common.QName;
10
11 /**
12  * 
13  *
14  */
15 public class YangModelInputStreamAdapter extends InputStream implements Delegator<InputStream> {
16
17     final String source;
18     final QName moduleIdentifier;
19     final InputStream delegate;
20     
21     
22     
23     private YangModelInputStreamAdapter(String source, QName moduleIdentifier, InputStream delegate) {
24         super();
25         this.source = source;
26         this.moduleIdentifier = moduleIdentifier;
27         this.delegate = delegate;
28     }
29
30     public int read() throws IOException {
31         return delegate.read();
32     }
33
34     public int hashCode() {
35         return delegate.hashCode();
36     }
37
38     public int read(byte[] b) throws IOException {
39         return delegate.read(b);
40     }
41
42     public boolean equals(Object obj) {
43         return delegate.equals(obj);
44     }
45
46     public int read(byte[] b, int off, int len) throws IOException {
47         return delegate.read(b, off, len);
48     }
49
50     public long skip(long n) throws IOException {
51         return delegate.skip(n);
52     }
53
54     public int available() throws IOException {
55         return delegate.available();
56     }
57
58     public void close() throws IOException {
59         delegate.close();
60     }
61
62     public void mark(int readlimit) {
63         delegate.mark(readlimit);
64     }
65
66     public void reset() throws IOException {
67         delegate.reset();
68     }
69
70     public boolean markSupported() {
71         return delegate.markSupported();
72     }
73
74     @Override
75     public InputStream getDelegate() {
76         return delegate;
77     }
78
79     @Override
80     public String toString() {
81         return "YangModelInputStreamAdapter [moduleIdentifier=" + moduleIdentifier + ", delegate=" + delegate + "]";
82     }
83
84     public static YangModelInputStreamAdapter create(QName name, String module) {
85         InputStream stringInput = new StringBufferInputStream(module);
86         return new YangModelInputStreamAdapter(null, name, stringInput );
87     }
88 }