All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pro.parseq.vcf.utils.InputStreamVcfReader Maven / Gradle / Ivy

There is a newer version: 1.1.1-RELEASE
Show newest version
/*******************************************************************************
 *     Copyright 2016-2017 the original author or authors.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  
 *******************************************************************************/
package pro.parseq.vcf.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * {@link VcfReader} implementation based on {@link BufferedReader}
 * 
 * @author Alexander Afanasyev [email protected]
 */
public class InputStreamVcfReader implements VcfReader {

	private static final Logger logger = LoggerFactory.getLogger(InputStreamVcfReader.class);

	private BufferedReader reader;

	public InputStreamVcfReader(InputStream vcf) {
		reader = new BufferedReader(new InputStreamReader(vcf));
	}

	@Override
	public String readLine() {
		try {
			return reader.readLine();
		} catch (IOException e) {
			logger.error("Error while reading VCF input stream: {}", e.getMessage());
			throw new RuntimeException(e.getMessage());
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy