1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

PDOM db: Improves reading char[] from chunks.

This commit is contained in:
Markus Schorn 2006-11-21 10:04:03 +00:00
parent b348ab9f8d
commit a83a57c3ba
2 changed files with 6 additions and 5 deletions

View file

@ -91,6 +91,11 @@ public class Chunk {
return buffer.getChar(offset % Database.CHUNK_SIZE);
}
public void getCharArray(int offset, char[] result) {
buffer.position(offset % Database.CHUNK_SIZE);
buffer.asCharBuffer().get(result);
}
void clear(int offset, int length) {
buffer.position(offset % Database.CHUNK_SIZE);
buffer.put(new byte[length]);

View file

@ -74,11 +74,7 @@ public class ShortString implements IString {
Chunk chunk = db.getChunk(record);
int length = chunk.getInt(record + LENGTH);
char[] chars = new char[length];
int p = record + CHARS;
for (int i = 0; i < length; ++i) {
chars[i] = chunk.getChar(p);
p += 2;
}
chunk.getCharArray(record+CHARS, chars);
return chars;
}