NativeIO (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.io.nativeio
Class NativeIO

    java.lang.Object
      org.apache.hadoop.io.nativeio.NativeIO

    public class NativeIO

extends Object

JNI wrappers for various native IO-related calls not available in Java. These functions should generally be used alongside a fallback to another more portable mechanism.

Nested Class Summary
`static class` | `NativeIO.Stat` Result type of the fstat call

Field Summary
`static int` | `O_APPEND`
`static int` | `O_ASYNC`
`static int` | `O_CREAT`
`static int` | `O_EXCL`
`static int` | `O_FSYNC`
`static int` | `O_NDELAY`
`static int` | `O_NOCTTY`
`static int` | `O_NONBLOCK`
`static int` | `O_RDONLY`
`static int` | `O_RDWR`
`static int` | `O_SYNC`
`static int` | `O_TRUNC`
`static int` | `O_WRONLY`
`static int` | `POSIX_FADV_DONTNEED`
`static int` | `POSIX_FADV_NOREUSE`
`static int` | `POSIX_FADV_NORMAL`
`static int` | `POSIX_FADV_RANDOM`
`static int` | `POSIX_FADV_SEQUENTIAL`
`static int` | `POSIX_FADV_WILLNEED`
`static int` | `SYNC_FILE_RANGE_WAIT_AFTER`
`static int` | `SYNC_FILE_RANGE_WAIT_BEFORE`
`static int` | `SYNC_FILE_RANGE_WRITE`

Constructor Summary
`NativeIO()`

Method Summary
`static void` | `chmod(String path, int mode)` Wrapper around chmod(2)
`static NativeIO.Stat` | `fstat(FileDescriptor fd)` Wrapper around fstat(2)
`static String` | `getOwner(FileDescriptor fd)`
`static boolean` | `isAvailable()` Return true if the JNI-based native IO extensions are available.
`static FileDescriptor` | `open(String path, int flags, int mode)` Wrapper around open(2)
`static void` | `posixFadviseIfPossible(FileDescriptor fd, long offset, long len, int flags)` Call posix_fadvise on the given file descriptor.
`static void` | `syncFileRangeIfPossible(FileDescriptor fd, long offset, long nbytes, int flags)` Call sync_file_range on the given file descriptor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### O_RDONLY

    public static final int O_RDONLY

See Also:
  Constant Field Values

### O_WRONLY

    public static final int O_WRONLY

See Also:
  Constant Field Values

### O_RDWR

    public static final int O_RDWR

See Also:
  Constant Field Values

### O_CREAT

    public static final int O_CREAT

See Also:
  Constant Field Values

### O_EXCL

    public static final int O_EXCL

See Also:
  Constant Field Values

### O_NOCTTY

    public static final int O_NOCTTY

See Also:
  Constant Field Values

### O_TRUNC

    public static final int O_TRUNC

See Also:
  Constant Field Values

### O_APPEND

    public static final int O_APPEND

See Also:
  Constant Field Values

### O_NONBLOCK

    public static final int O_NONBLOCK

See Also:
  Constant Field Values

### O_SYNC

    public static final int O_SYNC

See Also:
  Constant Field Values

### O_ASYNC

    public static final int O_ASYNC

See Also:
  Constant Field Values

### O_FSYNC

    public static final int O_FSYNC

See Also:
  Constant Field Values

### O_NDELAY

    public static final int O_NDELAY

See Also:
  Constant Field Values

### POSIX_FADV_NORMAL

    public static final int POSIX_FADV_NORMAL

See Also:
  Constant Field Values

### POSIX_FADV_RANDOM

    public static final int POSIX_FADV_RANDOM

See Also:
  Constant Field Values

### POSIX_FADV_SEQUENTIAL

    public static final int POSIX_FADV_SEQUENTIAL

See Also:
  Constant Field Values

### POSIX_FADV_WILLNEED

    public static final int POSIX_FADV_WILLNEED

See Also:
  Constant Field Values

### POSIX_FADV_DONTNEED

    public static final int POSIX_FADV_DONTNEED

See Also:
  Constant Field Values

### POSIX_FADV_NOREUSE

    public static final int POSIX_FADV_NOREUSE

See Also:
  Constant Field Values

### SYNC_FILE_RANGE_WAIT_BEFORE

    public static final int SYNC_FILE_RANGE_WAIT_BEFORE

See Also:
  Constant Field Values

### SYNC_FILE_RANGE_WRITE

    public static final int SYNC_FILE_RANGE_WRITE

See Also:
  Constant Field Values

### SYNC_FILE_RANGE_WAIT_AFTER

    public static final int SYNC_FILE_RANGE_WAIT_AFTER

See Also:
  Constant Field Values

Constructor Detail

### NativeIO

    public NativeIO()

Method Detail

### isAvailable

    public static boolean isAvailable()

  Return true if the JNI-based native IO extensions are available.

### open

    public static FileDescriptor open(String path,
                                      int flags,
                                      int mode)
                               throws IOException

  Wrapper around open(2)

  Throws:
    `IOException`

### fstat

    public static NativeIO.Stat fstat(FileDescriptor fd)
                               throws IOException

  Wrapper around fstat(2)

  Throws:
    `IOException`

### chmod

    public static void chmod(String path,
                             int mode)
                      throws IOException

  Wrapper around chmod(2)

  Throws:
    `IOException`

### posixFadviseIfPossible

    public static void posixFadviseIfPossible(FileDescriptor fd,
                                              long offset,
                                              long len,
                                              int flags)
                                       throws NativeIOException

  Call posix_fadvise on the given file descriptor. See the manpage for this syscall for more information. On systems where this call is not available, does nothing.

  Throws:
    `NativeIOException` - if there is an error with the syscall

### syncFileRangeIfPossible

    public static void syncFileRangeIfPossible(FileDescriptor fd,
                                               long offset,
                                               long nbytes,
                                               int flags)
                                        throws NativeIOException

  Call sync_file_range on the given file descriptor. See the manpage for this syscall for more information. On systems where this call is not available, does nothing.

  Throws:
    `NativeIOException` - if there is an error with the syscall

### getOwner

    public static String getOwner(FileDescriptor fd)
                           throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation