Files
sharpcompress/SharpCompress/Compressor/PPMd/H/RarNode.cs
Adam Hathcock 7ce4b7d076 Initial commit
2013-04-07 10:58:58 +01:00

53 lines
1.3 KiB
C#

using System.Text;
namespace SharpCompress.Compressor.PPMd.H
{
internal class RarNode : Pointer
{
private int next; //rarnode pointer
public const int size = 4;
public RarNode(byte[] Memory)
: base(Memory)
{
}
internal int GetNext()
{
if (Memory != null)
{
next = Utility.readIntLittleEndian(Memory, Address);
}
return next;
}
internal void SetNext(RarNode next)
{
SetNext(next.Address);
}
internal void SetNext(int next)
{
this.next = next;
if (Memory != null)
{
Utility.WriteLittleEndian(Memory, Address, next);
}
}
public override string ToString()
{
StringBuilder buffer = new StringBuilder();
buffer.Append("State[");
buffer.Append("\n Address=");
buffer.Append(Address);
buffer.Append("\n size=");
buffer.Append(size);
buffer.Append("\n next=");
buffer.Append(GetNext());
buffer.Append("\n]");
return buffer.ToString();
}
}
}