[KryoNet] Sending an int[][] over KryoNet

Good evening.
I am trying to send a int[][] from server to client using Kryonet. The size of array is 256x256, but is the same if i use an 1x1 array.
The problem is that if i try to send the “Level” object, the connection stops (after x seconds, the client is disconnected, but server still thinks that he is still connected). I have tried using a byte[][] and a byte[], but nothing changes. The array values are between 0 and 6.

This is my Object:

public static class Packet0Level {
	public int[][] map;
}

quite funny to use a serialization library to serialize a byte array into a byte array

Okay, now i’m trying to send to the client data about every tile, using a for. The error i get is:


Exception in thread "pool-1-thread-1" java.lang.NullPointerException
	at com.minier.network.NetworkListener.received(NetworkListener.java:27)
	at com.esotericsoftware.kryonet.Listener$QueuedListener$3.run(Listener.java:102)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

And here is the code at line 27:


public void received(Connection c, Object o) {
		if(o instanceof Packet0LevelInfo) {
			Packet0LevelInfo packet = (Packet0LevelInfo) o;
			Launcher.level = new Level(packet.levelWidth, packet.levelHeight);
		} else if(o instanceof Packet1LevelData) {
			Packet1LevelData packet = (Packet1LevelData) o;
/*LINE 27*/	Launcher.level.getMap()[packet.tileX][packet.tileY] = packet.tile; /*LINE 27*/
		} else if(o instanceof Packet2LevelFinished) {
			Launcher.levelLoaded = true;
		}
	}

I don’t see an int[][] in the code you posted.

so any of Launcher.level.getMap() is null. Set a breakpoint at that line to figure out which one.

I dont know if kryo have default support for arrays at the worst you have to write a custom Serializer.
http://code.google.com/p/kryo/#KryoSerializable
probably you just need something like this:


...
kryo.register(int[].class);

Already tried this…

This should drive Nate insane… maybe not…

why?

Ok. Thank you. I already solved the problem.
The problem was that the array was too big for client so i broke it into smaller chunks that are sent one after other. ;D