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

org.archive.streamcontext.HDFSStream Maven / Gradle / Ivy

There is a newer version: 1.1.9
Show newest version
package org.archive.streamcontext;

import java.io.IOException;

import org.apache.hadoop.fs.FSDataInputStream;

public class HDFSStream extends AbstractBufferingStream {
	FSDataInputStream hdfs;
	public HDFSStream(FSDataInputStream hdfs) {
		this.hdfs = hdfs;
	}
	public HDFSStream(FSDataInputStream hdfs, long offset) throws IOException {
		this.hdfs = hdfs;
		doSeek(offset);
	}

	@Override
	public int doRead(byte[] b, int off, int len) throws IOException {
		return hdfs.read(b, off, len);
	}

	@Override
	public void doSeek(long offset) throws IOException {
//		System.err.format("HDFSdoSeek(%d)\n", offset);
		hdfs.seek(offset);
	}

	@Override
	public void doClose() throws IOException {
		hdfs.close();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy