Point.java

/*
 * Copyright © 2011 Nokia Corporation. All rights reserved.
 * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
 * Oracle and Java are trademarks or registered trademarks of Oracle and/or its
 * affiliates. Other product and company names mentioned herein may be trademarks
 * or trade names of their respective owners.
 * See LICENSE.TXT for license information.
 */

package com.nokia.example.battletank.game;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class Point {
    public volatile int x, y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void writeTo(DataOutputStream dout) throws IOException {
        dout.writeInt(x);
        dout.writeInt(y);
    }

    public static Point readFrom(DataInputStream din) throws IOException {
        return new Point(din.readInt(), din.readInt());
    }
}