mirror of https://github.com/apache/cassandra
deserialize ipv6 addresses correctly. patch by Gary Dusbabek, reviewed by Jonathan Ellis. CASSANDRA-969
git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.6@933229 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4fe2f37ba0
commit
c2ea5dfa6a
|
|
@ -24,13 +24,15 @@ import java.net.InetAddress;
|
|||
public class CompactEndPointSerializationHelper
|
||||
{
|
||||
public static void serialize(InetAddress endPoint, DataOutputStream dos) throws IOException
|
||||
{
|
||||
dos.write(endPoint.getAddress());
|
||||
{
|
||||
byte[] buf = endPoint.getAddress();
|
||||
dos.writeByte(buf.length);
|
||||
dos.write(buf);
|
||||
}
|
||||
|
||||
public static InetAddress deserialize(DataInputStream dis) throws IOException
|
||||
{
|
||||
byte[] bytes = new byte[4];
|
||||
byte[] bytes = new byte[dis.readByte()];
|
||||
dis.readFully(bytes, 0, bytes.length);
|
||||
return InetAddress.getByAddress(bytes);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue