Lines Matching refs:buf

197             byte[] buf = mIndexHeader;
198 if (mIndexFile.read(buf) != INDEX_HEADER_SIZE) {
203 if (readInt(buf, IH_MAGIC) != MAGIC_INDEX_FILE) {
208 if (readInt(buf, IH_VERSION) != mVersion) {
213 mMaxEntries = readInt(buf, IH_MAX_ENTRIES);
214 mMaxBytes = readInt(buf, IH_MAX_BYTES);
215 mActiveRegion = readInt(buf, IH_ACTIVE_REGION);
216 mActiveEntries = readInt(buf, IH_ACTIVE_ENTRIES);
217 mActiveBytes = readInt(buf, IH_ACTIVE_BYTES);
219 int sum = readInt(buf, IH_CHECKSUM);
220 if (checkSum(buf, 0, IH_CHECKSUM) != sum) {
305 byte[] buf = mIndexHeader;
306 writeInt(buf, IH_MAGIC, MAGIC_INDEX_FILE);
307 writeInt(buf, IH_MAX_ENTRIES, maxEntries);
308 writeInt(buf, IH_MAX_BYTES, maxBytes);
309 writeInt(buf, IH_ACTIVE_REGION, 0);
310 writeInt(buf, IH_ACTIVE_ENTRIES, 0);
311 writeInt(buf, IH_ACTIVE_BYTES, DATA_HEADER_SIZE);
312 writeInt(buf, IH_VERSION, mVersion);
313 writeInt(buf, IH_CHECKSUM, checkSum(buf, 0, IH_CHECKSUM));
314 mIndexFile.write(buf);
322 writeInt(buf, 0, MAGIC_DATA_FILE);
323 mDataFile0.write(buf, 0, 4);
324 mDataFile1.write(buf, 0, 4);
628 static int readInt(byte[] buf, int offset) {
629 return (buf[offset] & 0xff)
630 | ((buf[offset + 1] & 0xff) << 8)
631 | ((buf[offset + 2] & 0xff) << 16)
632 | ((buf[offset + 3] & 0xff) << 24);
635 static long readLong(byte[] buf, int offset) {
636 long result = buf[offset + 7] & 0xff;
638 result = (result << 8) | (buf[offset + i] & 0xff);
643 static void writeInt(byte[] buf, int offset, int value) {
645 buf[offset + i] = (byte) (value & 0xff);
650 static void writeLong(byte[] buf, int offset, long value) {
652 buf[offset + i] = (byte) (value & 0xff);