2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang2sources.plugin;
10 import com.google.common.base.Preconditions;
12 import java.io.IOException;
13 import java.io.InputStream;
14 import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
16 class YangSourceFromFile extends YangSourceFromDependency {
18 private final File source;
20 public YangSourceFromFile(File source) {
21 this.source = Preconditions.checkNotNull(source);
25 public InputStream openStream() throws IOException {
27 return new NamedFileInputStream(source, YangToSourcesProcessor.META_INF_YANG_STRING + File.separator
32 public long size() throws IOException {
33 return source.length();
37 String getDescription() {
38 return source.getAbsolutePath();