Top Description Constructors Methods
com.sun.jna.platform.linux

public abstract Class XAttrUtil

extends Object
Class Inheritance
Imports
com.sun.jna.Memory, .Native, com.sun.jna.platform.linux.XAttr.size_t, .XAttr.ssize_t, java.io.IOException, java.nio.ByteBuffer, java.nio.charset.Charset, java.util.Collection, .LinkedHashSet, .Set

Utility functions class for handling file extended attributes on Linux.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

extended attribute value
fGetXAttr
(int
file handle
fd
,
String
extended attribute name
name
)

Get extended attribute value.

public static String

Returns:

extended attribute value
fGetXAttr
(int
file handle
fd
,
String
extended attribute name
name
,
String
character encoding to be used to decode stored extended attribute value
encoding
)

Get extended attribute value.

public static Memory

Returns:

extended attribute value
fGetXAttrAsMemory
(int
file handle
fd
,
String
extended attribute name
name
)

Get extended attribute value.

public static byte[]

Returns:

extended attribute value
fGetXAttrBytes
(int
file handle
fd
,
String
extended attribute name
name
)

Get extended attribute value.

public static Collection<String>

Returns:

collection of extended attributes' names
fListXAttr
(int
file handle
fd
)

List extended attributes on file.

public static Collection<String>

Returns:

collection of extended attributes' names
fListXAttr
(int
file handle
fd
,
String
character encoding use to decode extended attributes' names
encoding
)

List extended attributes on file.

public static void
fRemoveXAttr(int
file handle
fd
,
String
extended attribute name
name
)

Remove extended attribute from file.

public static void
fSetXAttr(int
file handle
fd
,
String
extended attribute name
name
,
String
value to set
value
)

Set or replace value of extended attribute.

public static void
fSetXAttr(int
file handle
fd
,
String
extended attribute name
name
,
String
value to set
value
,
String
character encoding to be used for stored value
encoding
)

Set or replace value of extended attribute.

public static void
fSetXAttr(int
file handle
fd
,
String
extended attribute name
name
,
byte[]
value to set
value
)

Set or replace value of extended attribute.

public static String

Returns:

extended attribute value
getXAttr
(String
file path
path
,
String
extended attribute name
name
)

Get extended attribute value.

public static String

Returns:

extended attribute value
getXAttr
(String
file path
path
,
String
extended attribute name
name
,
String
character encoding to be used to decode stored extended attribute value
encoding
)

Get extended attribute value.

public static Memory

Returns:

extended attribute value
getXAttrAsMemory
(String
file path
path
,
String
extended attribute name
name
)

Get extended attribute value.

public static byte[]

Returns:

extended attribute value
getXAttrBytes
(String
file path
path
,
String
extended attribute name
name
)

Get extended attribute value.

public static String

Returns:

extended attribute value
lGetXAttr
(String
file path
path
,
String
extended attribute name
name
)

Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.

public static String

Returns:

extended attribute value
lGetXAttr
(String
file path
path
,
String
extended attribute name
name
,
String
character encoding to be used to decode stored extended attribute value
encoding
)

Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.

public static Memory

Returns:

extended attribute value
lGetXAttrAsMemory
(String
file path
path
,
String
extended attribute name
name
)

Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.

public static byte[]

Returns:

extended attribute value
lGetXAttrBytes
(String
file path
path
,
String
extended attribute name
name
)

Get extended attribute value but in case of symbolic link get the value from the link itself instead of linked file.

public static Collection<String>

Returns:

collection of extended attributes' names
listXAttr
(String
file path
path
)

List extended attributes on file.

public static Collection<String>

Returns:

collection of extended attributes' names
listXAttr
(String
file path
path
,
String
character encoding use to decode extended attributes' names
encoding
)

List extended attributes on file.

public static Collection<String>

Returns:

collection of extended attributes' names
lListXAttr
(String
file path
path
)

List extended attributes on file but in case of symbolic link get extended attributes of the link itself instead of linked file.

public static Collection<String>

Returns:

collection of extended attributes' names
lListXAttr
(String
file path
path
,
String
character encoding use to decode extended attributes' names
encoding
)

List extended attributes on file but in case of symbolic link get extended attributes of the link itself instead of linked file.

public static void
lRemoveXAttr(String
file path
path
,
String
extended attribute name
name
)

Remove extended attribute from file but in case of symbolic link remove extended attribute from the link itself instead of linked file.

public static void
lSetXAttr(String
file path
path
,
String
extended attribute name
name
,
String
value to set
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.

public static void
lSetXAttr(String
file path
path
,
String
extended attribute name
name
,
String
value to set
value
,
String
character encoding to be used for stored value
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.

public static void
lSetXAttr(String
file path
path
,
String
extended attribute name
name
,
byte[]
value to set
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.

public static void
removeXAttr(String
file path
path
,
String
extended attribute name
name
)

Remove extended attribute from file.

public static void
setXAttr(String
file path
path
,
String
extended attribute name
name
,
String
value to set
value
)

Set or replace value of extended attribute.

public static void
setXAttr(String
file path
path
,
String
extended attribute name
name
,
String
value to set
value
,
String
character encoding to be used for stored value
encoding
)

Set or replace value of extended attribute.

public static void
setXAttr(String
file path
path
,
String
extended attribute name
name
,
byte[]
value to set
value
)

Set or replace value of extended attribute.

private static Collection<String>
splitBufferToStrings(byte[] valueMem, String encoding)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

XAttrUtilback to summary
private XAttrUtil()

Method Detail

fGetXAttrback to summary
public static String fGetXAttr(int fd, String name) throws IOException

Get extended attribute value.

Parameters
fd:int

file handle

name:String

extended attribute name

Returns:String

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
fGetXAttrback to summary
public static String fGetXAttr(int fd, String name, String encoding) throws IOException

Get extended attribute value.

Parameters
fd:int

file handle

name:String

extended attribute name

encoding:String

character encoding to be used to decode stored extended attribute value

Returns:String

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
fGetXAttrAsMemoryback to summary
public static Memory fGetXAttrAsMemory(int fd, String name) throws IOException

Get extended attribute value.

Parameters
fd:int

file handle

name:String

extended attribute name

Returns:Memory

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
fGetXAttrBytesback to summary
public static byte[] fGetXAttrBytes(int fd, String name) throws IOException

Get extended attribute value.

Parameters
fd:int

file handle

name:String

extended attribute name

Returns:byte[]

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
fListXAttrback to summary
public static Collection<String> fListXAttr(int fd) throws IOException

List extended attributes on file.

Parameters
fd:int

file handle

Returns:Collection<String>

collection of extended attributes' names

Exceptions
IOException:
on any error except ERANGE which handled internally
fListXAttrback to summary
public static Collection<String> fListXAttr(int fd, String encoding) throws IOException

List extended attributes on file.

Parameters
fd:int

file handle

encoding:String

character encoding use to decode extended attributes' names

Returns:Collection<String>

collection of extended attributes' names

Exceptions
IOException:
on any error except ERANGE which handled internally
fRemoveXAttrback to summary
public static void fRemoveXAttr(int fd, String name) throws IOException

Remove extended attribute from file.

Parameters
fd:int

file handle

name:String

extended attribute name

Exceptions
IOException:
on any error
fSetXAttrback to summary
public static void fSetXAttr(int fd, String name, String value) throws IOException

Set or replace value of extended attribute.

Parameters
fd:int

file handle

name:String

extended attribute name

value:String

value to set

Exceptions
IOException:
on any error
fSetXAttrback to summary
public static void fSetXAttr(int fd, String name, String value, String encoding) throws IOException

Set or replace value of extended attribute.

Parameters
fd:int

file handle

name:String

extended attribute name

value:String

value to set

encoding:String

character encoding to be used for stored value

Exceptions
IOException:
on any error
fSetXAttrback to summary
public static void fSetXAttr(int fd, String name, byte[] value) throws IOException

Set or replace value of extended attribute.

Parameters
fd:int

file handle

name:String

extended attribute name

value:byte[]

value to set

Exceptions
IOException:
on any error
getXAttrback to summary
public static String getXAttr(String path, String name) throws IOException

Get extended attribute value.

Parameters
path:String

file path

name:String

extended attribute name

Returns:String

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
getXAttrback to summary
public static String getXAttr(String path, String name, String encoding) throws IOException

Get extended attribute value.

Parameters
path:String

file path

name:String

extended attribute name

encoding:String

character encoding to be used to decode stored extended attribute value

Returns:String

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
getXAttrAsMemoryback to summary
public static Memory getXAttrAsMemory(String path, String name) throws IOException

Get extended attribute value.

Parameters
path:String

file path

name:String

extended attribute name

Returns:Memory

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
getXAttrBytesback to summary
public static byte[] getXAttrBytes(String path, String name) throws IOException

Get extended attribute value.

Parameters
path:String

file path

name:String

extended attribute name

Returns:byte[]

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
lGetXAttrback to summary
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:String

file path

name:String

extended attribute name

Returns:String

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
lGetXAttrback to summary
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:String

file path

name:String

extended attribute name

encoding:String

character encoding to be used to decode stored extended attribute value

Returns:String

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
lGetXAttrAsMemoryback to summary
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:String

file path

name:String

extended attribute name

Returns:Memory

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
lGetXAttrBytesback to summary
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:String

file path

name:String

extended attribute name

Returns:byte[]

extended attribute value

Exceptions
IOException:
on any error except ERANGE which handled internally
listXAttrback to summary
public static Collection<String> listXAttr(String path) throws IOException

List extended attributes on file.

Parameters
path:String

file path

Returns:Collection<String>

collection of extended attributes' names

Exceptions
IOException:
on any error except ERANGE which handled internally
listXAttrback to summary
public static Collection<String> listXAttr(String path, String encoding) throws IOException

List extended attributes on file.

Parameters
path:String

file path

encoding:String

character encoding use to decode extended attributes' names

Returns:Collection<String>

collection of extended attributes' names

Exceptions
IOException:
on any error except ERANGE which handled internally
lListXAttrback to summary
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:String

file path

Returns:Collection<String>

collection of extended attributes' names

Exceptions
IOException:
on any error except ERANGE which handled internally
lListXAttrback to summary
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:String

file path

encoding:String

character encoding use to decode extended attributes' names

Returns:Collection<String>

collection of extended attributes' names

Exceptions
IOException:
on any error except ERANGE which handled internally
lRemoveXAttrback to summary
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:String

file path

name:String

extended attribute name

Exceptions
IOException:
on any error
lSetXAttrback to summary
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:String

file path

name:String

extended attribute name

value:String

value to set

Exceptions
IOException:
on any error
lSetXAttrback to summary
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:String

file path

name:String

extended attribute name

value:String

value to set

encoding:String

character encoding to be used for stored value

Exceptions
IOException:
on any error
lSetXAttrback to summary
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:String

file path

name:String

extended attribute name

value:byte[]

value to set

Exceptions
IOException:
on any error
removeXAttrback to summary
public static void removeXAttr(String path, String name) throws IOException

Remove extended attribute from file.

Parameters
path:String

file path

name:String

extended attribute name

Exceptions
IOException:
on any error
setXAttrback to summary
public static void setXAttr(String path, String name, String value) throws IOException

Set or replace value of extended attribute.

Parameters
path:String

file path

name:String

extended attribute name

value:String

value to set

Exceptions
IOException:
on any error
setXAttrback to summary
public static void setXAttr(String path, String name, String value, String encoding) throws IOException

Set or replace value of extended attribute.

Parameters
path:String

file path

name:String

extended attribute name

value:String

value to set

encoding:String

character encoding to be used for stored value

Exceptions
IOException:
on any error
setXAttrback to summary
public static void setXAttr(String path, String name, byte[] value) throws IOException

Set or replace value of extended attribute.

Parameters
path:String

file path

name:String

extended attribute name

value:byte[]

value to set

Exceptions
IOException:
on any error
splitBufferToStringsback to summary
private static Collection<String> splitBufferToStrings(byte[] valueMem, String encoding) throws IOException