about UNIX_FD support in dbus java

Yi Hui Fan yihuifan at cn.ibm.com
Wed Feb 23 23:42:19 PST 2011


Dear Matt

Could you give me some advice which part should I change to support 
UNIX_FD in dbus java. I'd like to spend some time to implement it.

I debug the code. Here is the result.

1. Call a method which the return value is UNIX_FD
2. In MessageReader.readMessage() method, the input stream read buf[1] is 
3 which means the type of read message is Error.

I guess I have to put something in the out Message before I read the 
return to support UNIX_FD. What should I do? 

I create a class named UNIX_FD and the signature is 'h'. Here is the java 
code.

public class UnixFD extends Number implements Comparable<UnixFD>{
        /** Maximum allowed value */
           public static final long MAX_VALUE = 4294967295L;
           /** Minimum allowed value */
           public static final long MIN_VALUE = 0;
           private long value;
           /** Create a UnixFD from a long.
            * @param value Must be a valid integer within MIN_VALUE&ndash;
MAX_VALUE 
            * @throws NumberFormatException if value is not between 
MIN_VALUE and MAX_VALUE
            */
           public UnixFD(long value)
           {
              if (value < MIN_VALUE || value > MAX_VALUE)
                 throw new NumberFormatException(MessageFormat.format(_(
"{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, 
MAX_VALUE}));
              this.value = value;
           }
           /** Create a UnixFD from a String.
            * @param value Must parse to a valid integer within MIN_VALUE
&ndash;MAX_VALUE 
            * @throws NumberFormatException if value is not an integer 
between MIN_VALUE and MAX_VALUE
            */
           public UnixFD(String value)
           {
              this(Long.parseLong(value));
           }
           /** The value of this as a byte. */
           public byte byteValue() { return (byte) value; }
           /** The value of this as a double. */
           public double doubleValue() { return (double) value; }
           /** The value of this as a float. */
           public float floatValue() { return (float) value; }
           /** The value of this as a int. */
           public int intValue() { return (int) value; }
           /** The value of this as a long. */
           public long longValue() { return /*(long)*/ value; }
           /** The value of this as a short. */
           public short shortValue(){ return (short) value; }
           /** Test two UnixFD for equality. */
           public boolean equals(Object o)
           {
              return o instanceof UnixFD && ((UnixFD) o).value == this.
value;
           }
           public int hashCode()
           {
              return (int) value;
           }
           /** Compare two UnixFD. 
            * @return 0 if equal, -ve or +ve if they are different. 
            */
           public int compareTo(UnixFD other)
           {
              return (int) (this.value - other.value);
           }
           /** The value of this as a string */
           public String toString()
           {
              return ""+value;
           }
}

Thanks &
Best regards,

Yihui,Fan (范益辉)
Associate IT Architect
Healthcare Standards
Emerging Technology Institute(ETI)
IBM China Software Development Lab
Tel: (8610) 82454982  | Fax: (8610) 82453600 
Mobile: 86-13911564003| Email: yihuifan at cn.ibm.com
Address: Tower B, Diamond Building, Zhongguancun Software Park, Haidian 
District, Beijing 100193, P.R.China




Matthew Johnson <dbus at matthew.ath.cx> 
2011-02-16 19:17

To
Yi Hui Fan/China/IBM at IBMCN
cc
dbus at lists.freedesktop.org
Subject
Re: about UNIX_FD support in dbus java






On Mon Feb 14 14:19, Yi Hui Fan wrote:
> Dears
> 
> Is there any plan to support UNIX_FD data type and UNIX_FDS headers in 
> dbus java? We are going to develop an application in Java and Dbus. Some 

> features need UNIX_FD support. 

Currently I'm pushed for time and I've not thought how that would even 
work in
Java yet. I'm happy to accept sensible patches though.

Matt

[attachment "signature.asc" deleted by Yi Hui Fan/China/IBM] 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110224/79233e58/attachment-0001.html>


More information about the dbus mailing list