Package org.eclipse.mat.parser.index
Class IndexWriter.SizeIndexCollectorUncompressed
- java.lang.Object
-
- org.eclipse.mat.parser.index.IndexWriter.IntIndexCollectorUncompressed
-
- org.eclipse.mat.parser.index.IndexWriter.SizeIndexCollectorUncompressed
-
- Enclosing class:
- IndexWriter
public static class IndexWriter.SizeIndexCollectorUncompressed extends IndexWriter.IntIndexCollectorUncompressed
Store sizes of objects by compressing the size to a 32-bit int.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description SizeIndexCollectorUncompressed(int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
compress(long y)
Cope with objects bigger than Integer.MAX_VALUE.static long
expand(int x)
Expand the result of the compressionlong
getSize(int index)
void
set(int index, long value)
IIndexReader.IOne2SizeIndex
writeTo(File indexFile)
-
Methods inherited from class org.eclipse.mat.parser.index.IndexWriter.IntIndexCollectorUncompressed
get, set
-
-
-
-
Method Detail
-
compress
public static int compress(long y)
Cope with objects bigger than Integer.MAX_VALUE. E.g. double[Integer.MAX_VALUE] The original problem was that the array to size mapping had an integer as the size (IntIndexCollectorUncompressed). This array would be approximately 0x18 + 0x8 * 0x7fffffff = 0x400000010 bytes, too big for an int. Expanding the array size array to longs could be overkill. Instead we do some simple compression - values 0 - 0x7fffffff convert as now, int values 0x80000000 to 0xffffffff convert to(n & 0x7fffffffL)*8 + 0x80000000L
.- Parameters:
y
- the long value in the range -1 to 0x7fffffff, 0x80000000L to 0x400000000L- Returns:
- the compressed value as an int
-
expand
public static long expand(int x)
Expand the result of the compression- Parameters:
x
- the compressed value- Returns:
- the expanded value as a long in the range -1 to 0x7fffffff, 0x80000000L to 0x400000000L
-
set
public void set(int index, long value)
-
getSize
public long getSize(int index)
-
writeTo
public IIndexReader.IOne2SizeIndex writeTo(File indexFile) throws IOException
- Overrides:
writeTo
in classIndexWriter.IntIndexCollectorUncompressed
- Throws:
IOException
-
-