public boolean write(int id, byte... file) {
		synchronized(this) {
			try {
	            byte header[] = new byte[6];
	            int length = file.length;
	            int position = (int) ((data.length() + 519L) / 520L); // writing the
	            header[0] = (byte) (length >> 16);
	            header[1] = (byte) (length >> 8);
	            header[2] = (byte) length;
	            header[3] = (byte) (position >> 16);
	            header[4] = (byte) (position >> 8);
	            header[5] = (byte) position;
	            index.seek(id * 6);
	            index.write(header, 0, 6);
	            int offset = 0;
	            int blockIndex = 0;
	            byte[] header2 = new byte[8];
	            while (offset < length) {
	                position++; // simple
	                data.seek(position * 520);
	                header2[0] = (byte) (id >> 8);
	                header2[1] = (byte) id;
	                header2[2] = (byte) (blockIndex >> 8);
	                header2[3] = (byte) blockIndex;
	                header2[4] = (byte) (position >> 16);
	                header2[5] = (byte) (position >> 8);
	                header2[6] = (byte) position;
	                header2[7] = (byte) id;
	                data.write(header2, 0, 8);
	                int amt = length - offset;
	                if (amt > 512) {
	                    amt = 512;
	                }
	                data.write(file, offset, amt);
	                offset += amt;
	                blockIndex++;
	            }
	            return true;
			} catch(Exception e) {
				e.printStackTrace();
			}
		}
		return false;
	}