/// <summary> /// Replace the element with the entry at the current position of /// hpsgData. /// </summary> /// <param name="hs"> The heap segment to pull the entry from. </param> /// <returns> this object. </returns> /// <exception cref="BufferUnderflowException"> if there is not a whole entry /// following the current position of /// hpsgData. </exception> /// <exception cref="ParseException"> if the provided data is malformed. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public HeapSegmentElement set(HeapSegment hs) throws java.nio.BufferUnderflowException, java.text.ParseException public virtual HeapSegmentElement set(HeapSegment hs) { /* TODO: Maybe keep track of the virtual address of each element * so that they can be examined independently. */ ByteBuffer data = hs.mUsageData; int eState = data.get() & 0x000000ff; int eLen = (data.get() & 0x000000ff) + 1; while ((eState & PARTIAL_MASK) != 0) { /* If the partial bit was set, the next byte should describe * the same object as the current one. */ int nextState = data.get() & 0x000000ff; if ((nextState & ~PARTIAL_MASK) != (eState & ~PARTIAL_MASK)) { throw new ArgumentException("State mismatch at " + data.position); } eState = nextState; eLen += (data.get() & 0x000000ff) + 1; } solidity = eState & 0x7; kind = (eState >> 3) & 0x7; length = eLen * hs.mAllocationUnitSize; return(this); }
internal virtual void addHeapData(ByteBuffer data) { HeapSegment hs; if (mHeapDataComplete) { clearHeapData(); } try { hs = new HeapSegment(data); } catch (BufferUnderflowException) { Console.Error.WriteLine("Discarding short HPSG data (length " + data.limit + ")"); return; } mHeapSegments.Add(hs); }
/// <summary> /// Create an element describing the entry at the current /// position of hpsgData. /// </summary> /// <param name="hs"> The heap segment to pull the entry from. </param> /// <exception cref="BufferUnderflowException"> if there is not a whole entry /// following the current position /// of hpsgData. </exception> /// <exception cref="ParseException"> if the provided data is malformed. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public HeapSegmentElement(HeapSegment hs) throws java.nio.BufferUnderflowException, java.text.ParseException public HeapSegmentElement(HeapSegment hs) { set(hs); }