LimeWire Consolidated API

org.limewire.net.address
Class AddressFactoryImpl

java.lang.Object
  extended by org.limewire.net.address.AddressFactoryImpl
All Implemented Interfaces:
AddressFactory

public class AddressFactoryImpl
extends Object
implements AddressFactory


Constructor Summary
AddressFactoryImpl()
           
 
Method Summary
 Address deserialize(String address)
          turns a user-input String into an Address
 Address deserialize(String type, byte[] serializedAddress)
          Deserialize an address, typically as read from a network message
 AddressSerializer getSerializer(Class<? extends Address> addressClass)
           
 AddressSerializer getSerializer(String addressType)
          Looks up serializer by AddressSerializer.getAddressType().
 void registerSerializer(AddressSerializer serializer)
          Registers an AddressSerializer with this AddressFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddressFactoryImpl

public AddressFactoryImpl()
Method Detail

registerSerializer

public void registerSerializer(AddressSerializer serializer)
Description copied from interface: AddressFactory
Registers an AddressSerializer with this AddressFactory.

Specified by:
registerSerializer in interface AddressFactory

getSerializer

public AddressSerializer getSerializer(Class<? extends Address> addressClass)
Specified by:
getSerializer in interface AddressFactory
Parameters:
addressClass - cannot be null
Returns:
the AddressSerializer for a particular class

getSerializer

public AddressSerializer getSerializer(String addressType)
Description copied from interface: AddressFactory
Looks up serializer by AddressSerializer.getAddressType().

Specified by:
getSerializer in interface AddressFactory
Returns:
null if no serializer is registered for that type

deserialize

public Address deserialize(String type,
                           byte[] serializedAddress)
                    throws IOException
Description copied from interface: AddressFactory
Deserialize an address, typically as read from a network message

Specified by:
deserialize in interface AddressFactory
Parameters:
type - the type of message contained in the byte array. Will match AddressSerializer.getType() for the AddressSerialzer for the Address contained in the byte []
Returns:
a non-null Address
Throws:
IOException - if there is an error deserializing the Address

deserialize

public Address deserialize(String address)
                    throws IOException
Description copied from interface: AddressFactory
turns a user-input String into an Address

Specified by:
deserialize in interface AddressFactory
Returns:
an address representing the String parameter; never null
Throws:
IOException - if the input cannot be converted into an Address

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.