org.apache.hadoop.fs
Class FSDataOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.DataOutputStream
              extended by org.apache.hadoop.fs.FSDataOutputStream
All Implemented Interfaces:
Closeable, DataOutput, Flushable, CanSetDropBehind, Syncable

@InterfaceAudience.Public
@InterfaceStability.Stable
public class FSDataOutputStream
extends DataOutputStream
implements Syncable, CanSetDropBehind

Utility that wraps a OutputStream in a DataOutputStream.


Field Summary
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
FSDataOutputStream(OutputStream out)
          Deprecated. 
FSDataOutputStream(OutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats)
           
FSDataOutputStream(OutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats, long startPosition)
           
 
Method Summary
 void close()
          Close the underlying output stream.
 long getPos()
          Get the current position in the output stream.
 void hflush()
          Flush out the data in client's user buffer.
 void hsync()
          Similar to posix fsync, flush out the data in client's user buffer all the way to the disk device (but the disk may have it in its cache).
 void setDropBehind(Boolean dropBehind)
          Configure whether the stream should drop the cache.
 void sync()
          Deprecated. 
 
Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataOutput
write
 

Constructor Detail

FSDataOutputStream

@Deprecated
public FSDataOutputStream(OutputStream out)
                   throws IOException
Deprecated. 

Throws:
IOException

FSDataOutputStream

public FSDataOutputStream(OutputStream out,
                          org.apache.hadoop.fs.FileSystem.Statistics stats)
                   throws IOException
Throws:
IOException

FSDataOutputStream

public FSDataOutputStream(OutputStream out,
                          org.apache.hadoop.fs.FileSystem.Statistics stats,
                          long startPosition)
                   throws IOException
Throws:
IOException
Method Detail

getPos

public long getPos()
            throws IOException
Get the current position in the output stream.

Returns:
the current position in the output stream
Throws:
IOException

close

public void close()
           throws IOException
Close the underlying output stream.

Specified by:
close in interface Closeable
Overrides:
close in class FilterOutputStream
Throws:
IOException

sync

@Deprecated
public void sync()
          throws IOException
Deprecated. 

Specified by:
sync in interface Syncable
Throws:
IOException
See Also:
Syncable.hflush()

hflush

public void hflush()
            throws IOException
Description copied from interface: Syncable
Flush out the data in client's user buffer. After the return of this call, new readers will see the data.

Specified by:
hflush in interface Syncable
Throws:
IOException - if any error occurs

hsync

public void hsync()
           throws IOException
Description copied from interface: Syncable
Similar to posix fsync, flush out the data in client's user buffer all the way to the disk device (but the disk may have it in its cache).

Specified by:
hsync in interface Syncable
Throws:
IOException - if error occurs

setDropBehind

public void setDropBehind(Boolean dropBehind)
                   throws IOException
Description copied from interface: CanSetDropBehind
Configure whether the stream should drop the cache.

Specified by:
setDropBehind in interface CanSetDropBehind
Parameters:
dropBehind - Whether to drop the cache. null means to use the default value.
Throws:
IOException - If there was an error changing the dropBehind setting. UnsupportedOperationException If this stream doesn't support setting the drop-behind.


Copyright © 2014 Apache Software Foundation. All Rights Reserved.