List of usage examples for org.apache.hadoop.fs XAttrCodec encodeValue
public static String encodeValue(byte[] value, XAttrCodec encoding) throws IOException
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
@Override public void setXAttr(Path p, String name, byte[] value, EnumSet<XAttrSetFlag> flag) throws IOException { statistics.incrementWriteOps(1);// w w w. jav a 2 s.co m final HttpOpParam.Op op = PutOpParam.Op.SETXATTR; if (value != null) { new FsPathRunner(op, p, new XAttrNameParam(name), new XAttrValueParam(XAttrCodec.encodeValue(value, XAttrCodec.HEX)), new XAttrSetFlagParam(flag)) .run(); } else { new FsPathRunner(op, p, new XAttrNameParam(name), new XAttrSetFlagParam(flag)).run(); } }
From source file:com.bigstep.datalake.JsonUtil.java
License:Apache License
private static Map<String, Object> toJsonMap(final XAttr xAttr, final XAttrCodec encoding) throws IOException { if (xAttr == null) { return null; }/*from w ww.jav a 2 s .com*/ final Map<String, Object> m = new TreeMap<String, Object>(); m.put("name", XAttrHelper.getPrefixName(xAttr)); m.put("value", xAttr.getValue() != null ? XAttrCodec.encodeValue(xAttr.getValue(), encoding) : null); return m; }