Example usage for org.apache.hadoop.hdfs.web.resources XAttrEncodingParam XAttrEncodingParam

List of usage examples for org.apache.hadoop.hdfs.web.resources XAttrEncodingParam XAttrEncodingParam

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.web.resources XAttrEncodingParam XAttrEncodingParam.

Prototype

public XAttrEncodingParam(final String str) 

Source Link

Document

Constructor.

Usage

From source file:com.bigstep.datalake.DLFileSystem.java

License:Apache License

@Override
public byte[] getXAttr(Path p, final String name) throws IOException {
    final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS;
    return new FsPathResponseRunner<byte[]>(op, p, new XAttrNameParam(name),
            new XAttrEncodingParam(XAttrCodec.HEX)) {
        @Override/*from   w w w  .  ja  va 2  s  .  co  m*/
        byte[] decodeResponse(Map<?, ?> json) throws IOException {
            return JsonUtil.getXAttr(json, name);
        }
    }.run();
}

From source file:com.bigstep.datalake.DLFileSystem.java

License:Apache License

@Override
public Map<String, byte[]> getXAttrs(Path p) throws IOException {
    final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS;
    return new FsPathResponseRunner<Map<String, byte[]>>(op, p, new XAttrEncodingParam(XAttrCodec.HEX)) {
        @Override/*  w  w  w  . j  a  v  a 2s .c  o m*/
        Map<String, byte[]> decodeResponse(Map<?, ?> json) throws IOException {
            return JsonUtil.toXAttrs(json);
        }
    }.run();
}

From source file:com.bigstep.datalake.DLFileSystem.java

License:Apache License

@Override
public Map<String, byte[]> getXAttrs(Path p, final List<String> names) throws IOException {
    Preconditions.checkArgument(names != null && !names.isEmpty(), "XAttr names cannot be null or empty.");
    Param<?, ?>[] parameters = new Param<?, ?>[names.size() + 1];
    for (int i = 0; i < parameters.length - 1; i++) {
        parameters[i] = new XAttrNameParam(names.get(i));
    }/* ww w.  j  a  v  a2  s.c om*/
    parameters[parameters.length - 1] = new XAttrEncodingParam(XAttrCodec.HEX);

    final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS;
    return new FsPathResponseRunner<Map<String, byte[]>>(op, parameters, p) {
        @Override
        Map<String, byte[]> decodeResponse(Map<?, ?> json) throws IOException {
            return JsonUtil.toXAttrs(json);
        }
    }.run();
}