# OpenMode (sshj 0.7.0 API)
Date: 2012-01-08

## net.schmizz.sshj.sftp
Enum OpenMode

    java.lang.Object
      java.lang.Enum<OpenMode>
          net.schmizz.sshj.sftp.OpenMode

All Implemented Interfaces:
  Serializable, Comparable<OpenMode>

    public enum OpenMode

extends Enum<OpenMode>

Enum Constant Summary
`APPEND` Force all writes to append data at the end of the file.
`CREAT` If this flag is specified, then a new file will be created if one does not already exist (if `TRUNC` is specified, the new file will be truncated to zero length if it previously exists).
`EXCL` Causes the request to fail if the named file already exists.
`READ` Open the file for reading.
`TRUNC` Forces an existing file with the same name to be truncated to zero length when creating a file by specifying `CREAT`.
`WRITE` Open the file for writing.

Method Summary
`static int` `toMask(Set<OpenMode> modes)`
`static OpenMode` `valueOf(String name)` Returns the enum constant of this type with the specified name.
`static OpenMode[]` `values()` Returns an array containing the constants of this enum type, in the order they are declared.

Methods inherited from class java.lang.Enum
`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Enum Constant Detail

### READ

    public static final OpenMode READ

  Open the file for reading.

### WRITE

    public static final OpenMode WRITE

  Open the file for writing. If both this and `READ` are specified, the file is opened for both reading and writing.

### APPEND

    public static final OpenMode APPEND

  Force all writes to append data at the end of the file.

### CREAT

    public static final OpenMode CREAT

  If this flag is specified, then a new file will be created if one does not already exist (if `TRUNC` is specified, the new file will be truncated to zero length if it previously exists).

### TRUNC

    public static final OpenMode TRUNC

  Forces an existing file with the same name to be truncated to zero length when creating a file by specifying `CREAT`. `CREAT` MUST also be specified if this flag is used.

### EXCL

    public static final OpenMode EXCL

  Causes the request to fail if the named file already exists. `CREAT` MUST also be specified if this flag is used.

Method Detail

### values

    public static OpenMode[] values()

  Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

      for (OpenMode c : OpenMode.values())
          System.out.println(c);

  Returns:
    an array containing the constants of this enum type, in the order they are declared

### valueOf

    public static OpenMode valueOf(String name)

  Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

  Parameters:
    `name` - the name of the enum constant to be returned.
  Returns:
    the enum constant with the specified name
  Throws:
    `IllegalArgumentException` - if this enum type has no constant with the specified name
    `NullPointerException` - if the argument is null

### toMask

    public static int toMask(Set<OpenMode> modes)

Copyright © 2009-2012. All Rights Reserved.