public static void saveRegion( Region region, File dir )
    {
        File f = new File( dir, String.format( "r%d %d %d.gven.dat", region.x, region.y, region.z ) );

        if ( !createFile( f ) )
        {
            return;
        }

        Chunk[] chunks = region.getChunks();

        int[][] chunkCoords = new int[ chunks.length ][ 3 ];
        byte[][] voxels = new byte[ chunks.length ][ chunks[ 0 ].getVoxels().length ];

        for ( int i = 0; i < chunks.length; i++ )
        {
            chunkCoords[ i ][ 0 ] = chunks[ i ].x;
            chunkCoords[ i ][ 1 ] = chunks[ i ].y;
            chunkCoords[ i ][ 2 ] = chunks[ i ].z;

            for ( int j = 0; j < voxels[ i ].length; j++ )
            {
                voxels[ i ][ j ] = chunks[ i ].getVoxels()[ j ];
            }
        }

        try
        {
            DataOutputStream dos = new DataOutputStream( new FileOutputStream( f ) );

            // schedule writes for each chunk
            for ( int i = 0; i < chunks.length; i++ )
            {
                Scheduler.enqueueEvent( "writeChunk", RegionIO.class, dos, chunkCoords[ i ], voxels[ i ] );
            }

            // scheduler the closing of the stream after all the writes
            Scheduler.enqueueEvent( "close", dos ); // closes the stream after everything has been written
        }
        catch ( Exception e )
        {
            Lumberjack.throwable( "RegSave", e );
        }
    }