/*
- * 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;
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);
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);
}
}