Fix license header violations in yang-parser-impl
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / util / TextToASTTransformer.java
index 211e6a21743a666065e5e0ebc27aebb5cbb8de87..ae39e45aefe2b12044d99c26b8e78df149797d72 100644 (file)
@@ -1,15 +1,16 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
+
 package org.opendaylight.yangtools.yang.parser.util;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.Charsets;
-import com.google.common.io.CharStreams;
-import com.google.common.io.InputSupplier;
+import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 
@@ -48,18 +49,17 @@ public final class TextToASTTransformer extends SchemaSourceTransformer<YangText
                 LOG.debug("Model {} validated successfully", input);
 
                 // Backwards compatibility
-                final String text = CharStreams.toString(
-                        CharStreams.newReaderSupplier(new InputSupplier<InputStream>() {
-                            @Override
-                            public InputStream getInput() throws IOException {
-                                return input.openStream();
-                            }
-                        }, Charsets.UTF_8));
+                final String text = new ByteSource() {
+                    @Override
+                    public InputStream openStream() throws IOException {
+                        return input.openStream();
+                    }
+                }.asCharSource(Charsets.UTF_8).read();
 
                 return Futures.immediateCheckedFuture(ASTSchemaSource.create(input.getIdentifier().getName(), ctx, text));
             }
         }
-    };
+    }
 
     public static final TextToASTTransformation TRANSFORMATION = new TextToASTTransformation();
     private static final Logger LOG = LoggerFactory.getLogger(TextToASTTransformer.class);
@@ -68,7 +68,7 @@ public final class TextToASTTransformer extends SchemaSourceTransformer<YangText
         super(provider, YangTextSchemaSource.class, consumer, ASTSchemaSource.class, TRANSFORMATION);
     }
 
-    public static final TextToASTTransformer create(final SchemaRepository provider, final SchemaSourceRegistry consumer) {
+    public static TextToASTTransformer create(final SchemaRepository provider, final SchemaSourceRegistry consumer) {
         return new TextToASTTransformer(provider, consumer);
     }
 }