seek() публичный Метод

public seek ( long arg0 ) : void
arg0 long
Результат void
Пример #1
0
        public RegionFile(File file)
        {
            lastModified = 0L;
            fileName = file;
            debugln((new StringBuilder()).append("REGION LOAD ").append(fileName).toString());
            sizeDelta = 0;
            try
            {
                if (file.exists())
                {
                    lastModified = file.lastModified();
                }
                dataFile = new RandomAccessFile(file, "rw");
                if (dataFile.length() < 4096L)
                {
                    for (int i = 0; i < 1024; i++)
                    {
                        dataFile.writeInt(0);
                    }

                    for (int j = 0; j < 1024; j++)
                    {
                        dataFile.writeInt(0);
                    }

                    sizeDelta += 8192;
                }
                if ((dataFile.length() & 4095L) != 0L)
                {
                    for (int k = 0; k < (dataFile.length() & 4095L); k++)
                    {
                        dataFile.write(0);
                    }
                }
                int l = (int) dataFile.length()/4096;
                sectorFree = new ArrayList(l);
                for (int i1 = 0; i1 < l; i1++)
                {
                    sectorFree.add(Boolean.valueOf(true));
                }

                sectorFree.set(0, Boolean.valueOf(false));
                sectorFree.set(1, Boolean.valueOf(false));
                dataFile.seek(0L);
                for (int j1 = 0; j1 < 1024; j1++)
                {
                    int l1 = dataFile.readInt();
                    offsets[j1] = l1;
                    if (l1 == 0 || (l1 >> 8) + (l1 & 0xff) > sectorFree.size())
                    {
                        continue;
                    }
                    for (int j2 = 0; j2 < (l1 & 0xff); j2++)
                    {
                        sectorFree.set((l1 >> 8) + j2, Boolean.valueOf(false));
                    }
                }

                for (int k1 = 0; k1 < 1024; k1++)
                {
                    int i2 = dataFile.readInt();
                    chunkTimestamps[k1] = i2;
                }
            }
            catch (IOException ioexception)
            {
                ioexception.printStackTrace();
            }
        }