org.apache.hadoop.mapred
Class IFileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.apache.hadoop.mapred.IFileOutputStream
All Implemented Interfaces:
Closeable, Flushable

@InterfaceAudience.Private
@InterfaceStability.Unstable
public class IFileOutputStream
extends FilterOutputStream

A Checksum output stream. Checksum for the contents of the file is calculated and appended to the end of the file on close of the stream. Used for IFiles


Field Summary
protected  byte[] barray
           
protected  boolean finished
           
protected  org.apache.hadoop.util.DataChecksum sum
          The output stream to be checksummed.
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
IFileOutputStream(OutputStream out)
          Create a checksum output stream that writes the bytes to the given stream.
 
Method Summary
 void close()
           
 void finish()
          Finishes writing data to the output stream, by writing the checksum bytes to the end.
 void finish(long decompBytes, long compBytes)
           
 void write(byte[] b, int off, int len)
          Write bytes to the stream.
 void write(int b)
           
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sum

protected final org.apache.hadoop.util.DataChecksum sum
The output stream to be checksummed.


barray

protected byte[] barray

finished

protected boolean finished
Constructor Detail

IFileOutputStream

public IFileOutputStream(OutputStream out)
Create a checksum output stream that writes the bytes to the given stream.

Parameters:
out -
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class FilterOutputStream
Throws:
IOException

finish

public void finish()
            throws IOException
Finishes writing data to the output stream, by writing the checksum bytes to the end. The underlying stream is not closed.

Throws:
IOException

finish

public void finish(long decompBytes,
                   long compBytes)
            throws IOException
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Write bytes to the stream.

Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.