public override sealed string toHex()
{
try
{
long oldPos = getPos();
int size = (int)getSize();
byte[] temp = this.temp();
char[] hexChars = Buf.hexChars;
StringBuilder s = new StringBuilder(size*2);
setPos(0);
int total = 0;
while (total < size)
{
int n = m_stream.Read(temp, 0, Math.Min(temp.Length, size-total));
for (int i=0; i<n; ++i)
{
int b = temp[i] & 0xFF;
s.Append(hexChars[b>>4]).Append(hexChars[b&0xf]);
}
total += n;
}
setPos(oldPos);
return s.ToString();
}
catch (IOException e)
{
throw IOErr.make(e).val;
}
}