Package com.sun.jna.platform.linux
Class XAttrUtil
- java.lang.Object
-
- com.sun.jna.platform.linux.XAttrUtil
-
public abstract class XAttrUtil extends Object
Utility functions class for handling file extended attributes on Linux.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
fGetXAttr(int fd, String name)
Get extended attribute value.static String
fGetXAttr(int fd, String name, String encoding)
Get extended attribute value.static Memory
fGetXAttrAsMemory(int fd, String name)
Get extended attribute value.static byte[]
fGetXAttrBytes(int fd, String name)
Get extended attribute value.static Collection<String>
fListXAttr(int fd)
List extended attributes on file.static Collection<String>
fListXAttr(int fd, String encoding)
List extended attributes on file.static void
fRemoveXAttr(int fd, String name)
Remove extended attribute from file.static void
fSetXAttr(int fd, String name, byte[] value)
Set or replace value of extended attribute.static void
fSetXAttr(int fd, String name, String value)
Set or replace value of extended attribute.static void
fSetXAttr(int fd, String name, String value, String encoding)
Set or replace value of extended attribute.static String
getXAttr(String path, String name)
Get extended attribute value.static String
getXAttr(String path, String name, String encoding)
Get extended attribute value.static Memory
getXAttrAsMemory(String path, String name)
Get extended attribute value.static byte[]
getXAttrBytes(String path, String name)
Get extended attribute value.static String
lGetXAttr(String path, String name)
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.static String
lGetXAttr(String path, String name, String encoding)
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.static Memory
lGetXAttrAsMemory(String path, String name)
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.static byte[]
lGetXAttrBytes(String path, String name)
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.static Collection<String>
listXAttr(String path)
List extended attributes on file.static Collection<String>
listXAttr(String path, String encoding)
List extended attributes on file.static Collection<String>
lListXAttr(String path)
List extended attributes on file but in case of symbolic link get extended attributes of the link itself instead of linked file.static Collection<String>
lListXAttr(String path, String encoding)
List extended attributes on file but in case of symbolic link get extended attributes of the link itself instead of linked file.static void
lRemoveXAttr(String path, String name)
Remove extended attribute from file but in case of symbolic link remove extended attribute from the link itself instead of linked file.static void
lSetXAttr(String path, String name, byte[] value)
Set or replace value of extended attribute but in case of symbolic link set the extended attribute on the link itself instead linked file.static void
lSetXAttr(String path, String name, String value)
Set or replace value of extended attribute but in case of symbolic link set the extended attribute on the link itself instead linked file.static void
lSetXAttr(String path, String name, String value, String encoding)
Set or replace value of extended attribute but in case of symbolic link set the extended attribute on the link itself instead linked file.static void
removeXAttr(String path, String name)
Remove extended attribute from file.static void
setXAttr(String path, String name, byte[] value)
Set or replace value of extended attribute.static void
setXAttr(String path, String name, String value)
Set or replace value of extended attribute.static void
setXAttr(String path, String name, String value, String encoding)
Set or replace value of extended attribute.
-
-
-
Method Detail
-
setXAttr
public static void setXAttr(String path, String name, String value) throws IOException
Set or replace value of extended attribute.- Parameters:
path
- file pathname
- extended attribute namevalue
- value to set- Throws:
IOException
- on any error
-
setXAttr
public static void setXAttr(String path, String name, String value, String encoding) throws IOException
Set or replace value of extended attribute.- Parameters:
path
- file pathname
- extended attribute namevalue
- value to setencoding
- character encoding to be used for stored value- Throws:
IOException
- on any error
-
setXAttr
public static void setXAttr(String path, String name, byte[] value) throws IOException
Set or replace value of extended attribute.- Parameters:
path
- file pathname
- extended attribute namevalue
- value to set- Throws:
IOException
- on any error
-
lSetXAttr
public static void lSetXAttr(String path, String name, String value) throws IOException
Set or replace value of extended attribute but in case of symbolic link set the extended attribute on the link itself instead linked file.- Parameters:
path
- file pathname
- extended attribute namevalue
- value to set- Throws:
IOException
- on any error
-
lSetXAttr
public static void lSetXAttr(String path, String name, String value, String encoding) throws IOException
Set or replace value of extended attribute but in case of symbolic link set the extended attribute on the link itself instead linked file.- Parameters:
path
- file pathname
- extended attribute namevalue
- value to setencoding
- character encoding to be used for stored value- Throws:
IOException
- on any error
-
lSetXAttr
public static void lSetXAttr(String path, String name, byte[] value) throws IOException
Set or replace value of extended attribute but in case of symbolic link set the extended attribute on the link itself instead linked file.- Parameters:
path
- file pathname
- extended attribute namevalue
- value to set- Throws:
IOException
- on any error
-
fSetXAttr
public static void fSetXAttr(int fd, String name, String value) throws IOException
Set or replace value of extended attribute.- Parameters:
fd
- file handlename
- extended attribute namevalue
- value to set- Throws:
IOException
- on any error
-
fSetXAttr
public static void fSetXAttr(int fd, String name, String value, String encoding) throws IOException
Set or replace value of extended attribute.- Parameters:
fd
- file handlename
- extended attribute namevalue
- value to setencoding
- character encoding to be used for stored value- Throws:
IOException
- on any error
-
fSetXAttr
public static void fSetXAttr(int fd, String name, byte[] value) throws IOException
Set or replace value of extended attribute.- Parameters:
fd
- file handlename
- extended attribute namevalue
- value to set- Throws:
IOException
- on any error
-
getXAttr
public static String getXAttr(String path, String name) throws IOException
Get extended attribute value.- Parameters:
path
- file pathname
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
getXAttr
public static String getXAttr(String path, String name, String encoding) throws IOException
Get extended attribute value.- Parameters:
path
- file pathname
- extended attribute nameencoding
- character encoding to be used to decode stored extended attribute value- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
getXAttrBytes
public static byte[] getXAttrBytes(String path, String name) throws IOException
Get extended attribute value.- Parameters:
path
- file pathname
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
getXAttrAsMemory
public static Memory getXAttrAsMemory(String path, String name) throws IOException
Get extended attribute value.- Parameters:
path
- file pathname
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
lGetXAttr
public static String lGetXAttr(String path, String name) throws IOException
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.- Parameters:
path
- file pathname
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
lGetXAttr
public static String lGetXAttr(String path, String name, String encoding) throws IOException
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.- Parameters:
path
- file pathname
- extended attribute nameencoding
- character encoding to be used to decode stored extended attribute value- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
lGetXAttrBytes
public static byte[] lGetXAttrBytes(String path, String name) throws IOException
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.- Parameters:
path
- file pathname
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
lGetXAttrAsMemory
public static Memory lGetXAttrAsMemory(String path, String name) throws IOException
Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.- Parameters:
path
- file pathname
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
fGetXAttr
public static String fGetXAttr(int fd, String name) throws IOException
Get extended attribute value.- Parameters:
fd
- file handlename
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
fGetXAttr
public static String fGetXAttr(int fd, String name, String encoding) throws IOException
Get extended attribute value.- Parameters:
fd
- file handlename
- extended attribute nameencoding
- character encoding to be used to decode stored extended attribute value- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
fGetXAttrBytes
public static byte[] fGetXAttrBytes(int fd, String name) throws IOException
Get extended attribute value.- Parameters:
fd
- file handlename
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
fGetXAttrAsMemory
public static Memory fGetXAttrAsMemory(int fd, String name) throws IOException
Get extended attribute value.- Parameters:
fd
- file handlename
- extended attribute name- Returns:
- extended attribute value
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
listXAttr
public static Collection<String> listXAttr(String path) throws IOException
List extended attributes on file.- Parameters:
path
- file path- Returns:
- collection of extended attributes' names
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
listXAttr
public static Collection<String> listXAttr(String path, String encoding) throws IOException
List extended attributes on file.- Parameters:
path
- file pathencoding
- character encoding use to decode extended attributes' names- Returns:
- collection of extended attributes' names
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
lListXAttr
public static Collection<String> lListXAttr(String path) throws IOException
List extended attributes on file but in case of symbolic link get extended attributes of the link itself instead of linked file.- Parameters:
path
- file path- Returns:
- collection of extended attributes' names
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
lListXAttr
public static Collection<String> lListXAttr(String path, String encoding) throws IOException
List extended attributes on file but in case of symbolic link get extended attributes of the link itself instead of linked file.- Parameters:
path
- file pathencoding
- character encoding use to decode extended attributes' names- Returns:
- collection of extended attributes' names
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
fListXAttr
public static Collection<String> fListXAttr(int fd) throws IOException
List extended attributes on file.- Parameters:
fd
- file handle- Returns:
- collection of extended attributes' names
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
fListXAttr
public static Collection<String> fListXAttr(int fd, String encoding) throws IOException
List extended attributes on file.- Parameters:
fd
- file handleencoding
- character encoding use to decode extended attributes' names- Returns:
- collection of extended attributes' names
- Throws:
IOException
- on any error exceptERANGE
which handled internally
-
removeXAttr
public static void removeXAttr(String path, String name) throws IOException
Remove extended attribute from file.- Parameters:
path
- file pathname
- extended attribute name- Throws:
IOException
- on any error
-
lRemoveXAttr
public static void lRemoveXAttr(String path, String name) throws IOException
Remove extended attribute from file but in case of symbolic link remove extended attribute from the link itself instead of linked file.- Parameters:
path
- file pathname
- extended attribute name- Throws:
IOException
- on any error
-
fRemoveXAttr
public static void fRemoveXAttr(int fd, String name) throws IOException
Remove extended attribute from file.- Parameters:
fd
- file handlename
- extended attribute name- Throws:
IOException
- on any error
-
-