congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
FSEditLogLoader$PositionTrackingInputStream
Code IndexAdd Tabnine to your IDE (free)

How to use
FSEditLogLoader$PositionTrackingInputStream
in
org.apache.hadoop.hdfs.server.namenode

Best Java code snippets using org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader$PositionTrackingInputStream (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-hdfs

fStream = log.getInputStream();
bin = new BufferedInputStream(fStream);
tracker = new FSEditLogLoader.PositionTrackingInputStream(bin);
dataIn = new DataInputStream(tracker);
try {
origin: org.apache.hadoop/hadoop-hdfs

long skipAmt = log.length() - tracker.getPos();
if (skipAmt > 0) {
 if (LOG.isDebugEnabled()) {
    " out of " + lastTxId);
 tracker.clearLimit();
 IOUtils.skipFully(tracker, skipAmt);
origin: org.apache.hadoop/hadoop-hdfs

@Override
public int read(byte[] data, int offset, int length) throws IOException {
 checkLimit(length);
 int ret = super.read(data, offset, length);
 if (ret > 0) curPos += ret;
 return ret;
}
origin: ch.cern.hadoop/hadoop-hdfs

long skipAmt = log.length() - tracker.getPos();
if (skipAmt > 0) {
 if (LOG.isDebugEnabled()) {
    " out of " + lastTxId);
 tracker.clearLimit();
 IOUtils.skipFully(tracker, skipAmt);
origin: io.prestosql.hadoop/hadoop-apache

long skipAmt = log.length() - tracker.getPos();
if (skipAmt > 0) {
 if (LOG.isDebugEnabled()) {
    " out of " + lastTxId);
 tracker.clearLimit();
 IOUtils.skipFully(tracker, skipAmt);
origin: ch.cern.hadoop/hadoop-hdfs

BufferedInputStream bin = new BufferedInputStream(fin);
FSEditLogLoader.PositionTrackingInputStream tracker = 
  new FSEditLogLoader.PositionTrackingInputStream(bin);
try {
 tracker.setLimit(2);
 tracker.mark(100);
 tracker.read();
 tracker.read();
 try {
  tracker.read();
  fail("expected to get IOException after reading past the limit");
 } catch (IOException e) {
 tracker.reset();
 tracker.mark(100);
 byte arr[] = new byte[3];
 try {
  tracker.read(arr);
  fail("expected to get IOException after reading past the limit");
 } catch (IOException e) {
 tracker.reset();
 arr = new byte[2];
 tracker.read(arr);
} finally {
 tracker.close();
origin: ch.cern.hadoop/hadoop-hdfs

fStream = log.getInputStream();
bin = new BufferedInputStream(fStream);
tracker = new FSEditLogLoader.PositionTrackingInputStream(bin);
dataIn = new DataInputStream(tracker);
try {
origin: io.prestosql.hadoop/hadoop-apache

fStream = log.getInputStream();
bin = new BufferedInputStream(fStream);
tracker = new FSEditLogLoader.PositionTrackingInputStream(bin);
dataIn = new DataInputStream(tracker);
try {
origin: com.facebook.hadoop/hadoop-core

/**
 * Open an EditLogInputStream for the given file.
 * @param name filename to open
 * @param firstTxId first transaction found in file
 * @param lastTxId last transaction id found in file
 * @throws LogHeaderCorruptException if the header is either missing or
 *         appears to be corrupt/truncated
 * @throws IOException if an actual IO error occurs while reading the
 *         header
 */
EditLogFileInputStream(File name, long firstTxId, long lastTxId)
  throws LogHeaderCorruptException, IOException {
 file = name;
 rp = new RandomAccessFile(file, "r");    
 fStream = new FileInputStream(rp.getFD());
 fc = rp.getChannel();
 BufferedInputStream bin = new BufferedInputStream(fStream);  
 tracker = new FSEditLogLoader.PositionTrackingInputStream(bin);  
 DataInputStream in = new DataInputStream(tracker);
 try {
  logVersion = readLogVersion(in);
 } catch (EOFException eofe) {
  throw new LogHeaderCorruptException("No header found in log");
 }
 reader = new FSEditLogOp.Reader(in, logVersion);
 this.firstTxId = firstTxId;
 this.lastTxId = lastTxId;
}
origin: io.prestosql.hadoop/hadoop-apache

/**
 * Process image file.
 */
public void go() throws IOException  {
 DataInputStream in = null;
 PositionTrackingInputStream tracker = null;
 ImageLoader fsip = null;
 boolean done = false;
 try {
  tracker = new PositionTrackingInputStream(new BufferedInputStream(
       new FileInputStream(new File(inputFile))));
  in = new DataInputStream(tracker);
  int imageVersionFile = findImageVersion(in);
  fsip = ImageLoader.LoaderFactory.getLoader(imageVersionFile);
  if(fsip == null) 
   throw new IOException("No image processor to read version " +
     imageVersionFile + " is available.");
  fsip.loadImage(in, processor, skipBlocks);
  done = true;
 } finally {
  if (!done) {
   LOG.error("image loading failed at offset " + tracker.getPos());
  }
  IOUtils.cleanup(LOG, in, tracker);
 }
}
origin: ch.cern.hadoop/hadoop-hdfs

/**
 * Process image file.
 */
public void go() throws IOException  {
 DataInputStream in = null;
 PositionTrackingInputStream tracker = null;
 ImageLoader fsip = null;
 boolean done = false;
 try {
  tracker = new PositionTrackingInputStream(new BufferedInputStream(
       new FileInputStream(new File(inputFile))));
  in = new DataInputStream(tracker);
  int imageVersionFile = findImageVersion(in);
  fsip = ImageLoader.LoaderFactory.getLoader(imageVersionFile);
  if(fsip == null) 
   throw new IOException("No image processor to read version " +
     imageVersionFile + " is available.");
  fsip.loadImage(in, processor, skipBlocks);
  done = true;
 } finally {
  if (!done) {
   LOG.error("image loading failed at offset " + tracker.getPos());
  }
  IOUtils.cleanup(LOG, in, tracker);
 }
}
origin: io.prestosql.hadoop/hadoop-apache

@Override
public long getPosition() {
 return tracker.getPos();
}
origin: ch.cern.hadoop/hadoop-hdfs

@Override
public long getPosition() {
 return tracker.getPos();
}
origin: ch.cern.hadoop/hadoop-hdfs

@Override
public long getPosition() {
 return tracker.getPos();
}
origin: io.prestosql.hadoop/hadoop-apache

void setBytes(byte[] newBytes, int version) throws IOException {
 inner.setData(newBytes);
 tracker = new FSEditLogLoader.PositionTrackingInputStream(inner);
 in = new DataInputStream(tracker);
 this.version = version;
 reader = new FSEditLogOp.Reader(in, tracker, version);
}
origin: io.prestosql.hadoop/hadoop-apache

@Override
public long getPosition() {
 if (state == State.OPEN) {
  return tracker.getPos();
 } else {
  return 0;
 }
}
origin: io.prestosql.hadoop/hadoop-apache

@Override
public int read(byte[] data) throws IOException {
 checkLimit(data.length);
 int ret = super.read(data);
 if (ret > 0) curPos += ret;
 return ret;
}
origin: io.prestosql.hadoop/hadoop-apache

@Override
public int read(byte[] data, int offset, int length) throws IOException {
 checkLimit(length);
 int ret = super.read(data, offset, length);
 if (ret > 0) curPos += ret;
 return ret;
}
origin: com.facebook.hadoop/hadoop-core

@Override
public long getPosition() throws IOException{
 return tracker.getPos();
}

origin: ch.cern.hadoop/hadoop-hdfs

@Override
public int read(byte[] data) throws IOException {
 checkLimit(data.length);
 int ret = super.read(data);
 if (ret > 0) curPos += ret;
 return ret;
}
org.apache.hadoop.hdfs.server.namenodeFSEditLogLoader$PositionTrackingInputStream

Javadoc

Stream wrapper that keeps track of the current stream position. This stream also allows us to set a limit on how many bytes we can read without getting an exception.

Most used methods

  • <init>
  • getPos
  • checkLimit
  • clearLimit
  • close
  • mark
  • read
  • reset
  • setLimit

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Join (org.hibernate.mapping)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now