private void readSAT() throws IOException { if (SAT != null) { return; } final int intsPerSector = sectorSize / 4; // Read the Sector Allocation Table SAT = new int[masterSAT.length * intsPerSector]; for (int i = 0; i < masterSAT.length; i++) { seekToSId(masterSAT[i], FREE_SID); for (int j = 0; j < intsPerSector; j++) { int nextSID = input.readInt(); int index = (j + (i * intsPerSector)); SAT[index] = nextSID; } } // Read the short-stream Sector Allocation Table SIdChain chain = getSIdChain(shortSATSId, FREE_SID); shortSAT = new int[shortSATSize * intsPerSector]; for (int i = 0; i < shortSATSize; i++) { seekToSId(chain.get(i), FREE_SID); for (int j = 0; j < intsPerSector; j++) { int nextSID = input.readInt(); int index = (j + (i * intsPerSector)); shortSAT[index] = nextSID; } } }
private void seekToDId(final int pDId) throws IOException { if (directorySIdChain == null) { directorySIdChain = getSIdChain(directorySId, FREE_SID); } int dIdsPerSId = sectorSize / Entry.LENGTH; int sIdOffset = pDId / dIdsPerSId; int dIdOffset = pDId - (sIdOffset * dIdsPerSId); int sId = directorySIdChain.get(sIdOffset); seekToSId(sId, FREE_SID); if (input instanceof LittleEndianRandomAccessFile) { LittleEndianRandomAccessFile input = (LittleEndianRandomAccessFile) this.input; input.seek(input.getFilePointer() + dIdOffset * Entry.LENGTH); } else if (input instanceof ImageInputStream) { ImageInputStream input = (ImageInputStream) this.input; input.seek(input.getStreamPosition() + dIdOffset * Entry.LENGTH); } else { SeekableLittleEndianDataInputStream input = (SeekableLittleEndianDataInputStream) this.input; input.seek(input.getStreamPosition() + dIdOffset * Entry.LENGTH); } }
private void readSAT() throws IOException { if (SAT != null) { return; } final int intsPerSector = sectorSize / 4; // Read the Sector Allocation Table SAT = new int[masterSAT.length * intsPerSector]; for (int i = 0; i < masterSAT.length; i++) { seekToSId(masterSAT[i], FREE_SID); for (int j = 0; j < intsPerSector; j++) { int nextSID = input.readInt(); int index = (j + (i * intsPerSector)); SAT[index] = nextSID; } } // Read the short-stream Sector Allocation Table SIdChain chain = getSIdChain(shortSATSId, FREE_SID); shortSAT = new int[shortSATSize * intsPerSector]; for (int i = 0; i < shortSATSize; i++) { seekToSId(chain.get(i), FREE_SID); for (int j = 0; j < intsPerSector; j++) { int nextSID = input.readInt(); int index = (j + (i * intsPerSector)); shortSAT[index] = nextSID; } } }
private void readSAT() throws IOException { if (mSAT != null) { return; } final int intsPerSector = mSectorSize / 4; // Read the Sector Allocation Table mSAT = new int[mMasterSAT.length * intsPerSector]; for (int i = 0; i < mMasterSAT.length; i++) { seekToSId(mMasterSAT[i], FREE_SID); for (int j = 0; j < intsPerSector; j++) { int nextSID = mInput.readInt(); int index = (j + (i * intsPerSector)); mSAT[index] = nextSID; } } // Read the short-stream Sector Allocation Table SIdChain chain = getSIdChain(mShortSATSID, FREE_SID); mShortSAT = new int[mShortSATSize * intsPerSector]; for (int i = 0; i < mShortSATSize; i++) { seekToSId(chain.get(i), FREE_SID); for (int j = 0; j < intsPerSector; j++) { int nextSID = mInput.readInt(); int index = (j + (i * intsPerSector)); mShortSAT[index] = nextSID; } } }
private void seekToDId(final int pDId) throws IOException { if (mDirectorySIdChain == null) { mDirectorySIdChain = getSIdChain(mDirectorySId, FREE_SID); } int dIdsPerSId = mSectorSize / Entry.LENGTH; int sIdOffset = pDId / dIdsPerSId; int dIdOffset = pDId - (sIdOffset * dIdsPerSId); int sId = mDirectorySIdChain.get(sIdOffset); seekToSId(sId, FREE_SID); if (mInput instanceof LittleEndianRandomAccessFile) { LittleEndianRandomAccessFile input = (LittleEndianRandomAccessFile) mInput; input.seek(input.getFilePointer() + dIdOffset * Entry.LENGTH); } else if (mInput instanceof ImageInputStream) { ImageInputStream input = (ImageInputStream) mInput; input.seek(input.getStreamPosition() + dIdOffset * Entry.LENGTH); } else { SeekableLittleEndianDataInputStream input = (SeekableLittleEndianDataInputStream) mInput; input.seek(input.getStreamPosition() + dIdOffset * Entry.LENGTH); } }
private void seekToDId(final int pDId) throws IOException { if (directorySIdChain == null) { directorySIdChain = getSIdChain(directorySId, FREE_SID); } int dIdsPerSId = sectorSize / Entry.LENGTH; int sIdOffset = pDId / dIdsPerSId; int dIdOffset = pDId - (sIdOffset * dIdsPerSId); int sId = directorySIdChain.get(sIdOffset); seekToSId(sId, FREE_SID); if (input instanceof LittleEndianRandomAccessFile) { LittleEndianRandomAccessFile input = (LittleEndianRandomAccessFile) this.input; input.seek(input.getFilePointer() + dIdOffset * Entry.LENGTH); } else if (input instanceof ImageInputStream) { ImageInputStream input = (ImageInputStream) this.input; input.seek(input.getStreamPosition() + dIdOffset * Entry.LENGTH); } else { SeekableLittleEndianDataInputStream input = (SeekableLittleEndianDataInputStream) this.input; input.seek(input.getStreamPosition() + dIdOffset * Entry.LENGTH); } }