Example usage for org.apache.hadoop.fs CreateFlag validate

List of usage examples for org.apache.hadoop.fs CreateFlag validate

Introduction

In this page you can find the example usage for org.apache.hadoop.fs CreateFlag validate.

Prototype

public static void validate(EnumSet<CreateFlag> flag) 

Source Link

Document

Validate the CreateFlag and throw exception if it is invalid

Usage

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Same as {{@link #create(String, FsPermission, EnumSet, short, long, Progressable, int, ChecksumOpt)} except that the permission
 * is absolute (ie has already been masked with umask.
 *//*from   w  ww .  j ava  2s  .  com*/
public DFSOutputStream primitiveCreate(String src, FsPermission absPermission, EnumSet<CreateFlag> flag,
        boolean createParent, short replication, long blockSize, Progressable progress, int buffersize,
        ChecksumOpt checksumOpt) throws IOException, UnresolvedLinkException {
    checkOpen();
    CreateFlag.validate(flag);
    DFSOutputStream result = primitiveAppend(src, flag, buffersize, progress);
    if (result == null) {
        DataChecksum checksum = dfsClientConf.createChecksum(checksumOpt);
        result = DFSOutputStream.newStreamForCreate(this, src, absPermission, flag, createParent, replication,
                blockSize, progress, buffersize, checksum, null);
    }
    beginFileLease(result.getFileId(), result);
    return result;
}

From source file:com.quantcast.qfs.hadoop.Qfs.java

License:Apache License

@Override
public FSDataOutputStream createInternal(Path path, EnumSet<CreateFlag> createFlag,
        FsPermission absolutePermission, int bufferSize, short replication, long blockSize,
        Progressable progress, ChecksumOpt checksumOpt, boolean createParent) throws IOException {
    CreateFlag.validate(createFlag);
    checkPath(path);// www.  j  ava 2 s  . com
    if (createParent) {
        mkdir(path.getParent(), absolutePermission, createParent);
    }
    return qfsImpl.create(getUriPath(path), replication, bufferSize, createFlag.contains(CreateFlag.OVERWRITE),
            absolutePermission.toShort(), createFlag.contains(CreateFlag.APPEND));
}