public Object readObject()

in hessian-lite/src/main/java/com/alibaba/com/caucho/hessian/io/socket/InetSocketAddressDeserializer.java [48:84]


    public Object readObject(AbstractHessianInput in,
                             String[] fieldNames)
            throws IOException {
        try {
            String hostName = null;
            InetAddress address = null;
            int port = 0;
            for (String fieldName : fieldNames) {
                if ("hostName".equals(fieldName)) {
                    hostName = in.readString();
                } else if ("addr".equals(fieldName)) {
                    address = (InetAddress) in.readObject();
                } else if ("port".equals(fieldName)) {
                    port = in.readInt();
                } else {
                    in.readObject();
                }
            }

            InetSocketAddress obj;
            if (address != null) {
                obj = new InetSocketAddress(address, port);
            } else if (hostName != null){
                obj = new InetSocketAddress(hostName, port);
            } else {
                obj = new InetSocketAddress(port);
            }

            in.addRef(obj);

            return obj;
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new IOExceptionWrapper("java.net.InetSocketAddress:" + e, e);
        }
    }