mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-12 15:29:28 +00:00
Tidying
This commit is contained in:
parent
0557c2340e
commit
290a3dbfb4
|
@ -10,7 +10,7 @@ public class CellAddress
|
||||||
public CellAddress (byte[] buffer, int offset)
|
public CellAddress (byte[] buffer, int offset)
|
||||||
{
|
{
|
||||||
colRef = buffer[offset];
|
colRef = buffer[offset];
|
||||||
rowRef = HexFormatter.getSignedWord (buffer[offset + 1], buffer[offset + 2]);
|
rowRef = HexFormatter.intValue (buffer[offset + 1], buffer[offset + 2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,10 +89,9 @@ public class HexFormatter
|
||||||
else
|
else
|
||||||
c -= 128;
|
c -= 128;
|
||||||
}
|
}
|
||||||
if (c < 32 || c == 127) // non-printable
|
if (c < 32 || c == 127) // non-printable
|
||||||
trans.append (".");
|
trans.append (".");
|
||||||
else
|
else // standard ascii
|
||||||
// standard ascii
|
|
||||||
trans.append ((char) c);
|
trans.append ((char) c);
|
||||||
}
|
}
|
||||||
while (hexLine.length () < 48)
|
while (hexLine.length () < 48)
|
||||||
|
@ -132,7 +131,7 @@ public class HexFormatter
|
||||||
c -= 128;
|
c -= 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c < 32 || c == 127) // non-printable
|
if (c < 32 || c == 127) // non-printable
|
||||||
trans.append (".");
|
trans.append (".");
|
||||||
else
|
else
|
||||||
trans.append ((char) c); // standard ascii
|
trans.append ((char) c); // standard ascii
|
||||||
|
@ -161,10 +160,9 @@ public class HexFormatter
|
||||||
}
|
}
|
||||||
if (c == 13)
|
if (c == 13)
|
||||||
text.append ("\n");
|
text.append ("\n");
|
||||||
else if (c < 32) // non-printable
|
else if (c < 32) // non-printable
|
||||||
text.append (".");
|
text.append (".");
|
||||||
else
|
else // standard ascii
|
||||||
// standard ascii
|
|
||||||
text.append ((char) c);
|
text.append ((char) c);
|
||||||
}
|
}
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
|
@ -191,10 +189,9 @@ public class HexFormatter
|
||||||
else
|
else
|
||||||
c -= 128;
|
c -= 128;
|
||||||
}
|
}
|
||||||
if (c < 32) // non-printable
|
if (c < 32) // non-printable
|
||||||
text.append ((char) (c + 64));
|
text.append ((char) (c + 64));
|
||||||
else
|
else // standard ascii
|
||||||
// standard ascii
|
|
||||||
text.append ((char) c);
|
text.append ((char) c);
|
||||||
}
|
}
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
|
@ -246,9 +243,9 @@ public class HexFormatter
|
||||||
c -= 128;
|
c -= 128;
|
||||||
if (c > 95)
|
if (c > 95)
|
||||||
c -= 64;
|
c -= 64;
|
||||||
if (c < 32) // non-printable
|
if (c < 32) // non-printable
|
||||||
return '.';
|
return '.';
|
||||||
return (char) c; // standard ascii
|
return (char) c; // standard ascii
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,11 +285,6 @@ public class HexFormatter
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static int intValue (byte b1)
|
|
||||||
// {
|
|
||||||
// return b1 & 0xFF;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static int intValue (byte b1, byte b2)
|
public static int intValue (byte b1, byte b2)
|
||||||
{
|
{
|
||||||
return (b1 & 0xFF) + (b2 & 0xFF) * 256;
|
return (b1 & 0xFF) + (b2 & 0xFF) * 256;
|
||||||
|
@ -342,7 +334,7 @@ public class HexFormatter
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
val <<= 8;
|
val <<= 8;
|
||||||
val += buffer[ptr + i] & 0xFF;
|
val |= buffer[ptr + i] & 0xFF;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -359,28 +351,6 @@ public class HexFormatter
|
||||||
return Double.longBitsToDouble (bits);
|
return Double.longBitsToDouble (bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static int getWord (byte[] buffer, int ptr)
|
|
||||||
// {
|
|
||||||
// int val = 0;
|
|
||||||
// for (int i = 1; i >= 0; i--)
|
|
||||||
// {
|
|
||||||
// val <<= 8;
|
|
||||||
// val += buffer[ptr + i] & 0xFF;
|
|
||||||
// }
|
|
||||||
// return val;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static int getSignedWord (byte b1, byte b2)
|
|
||||||
{
|
|
||||||
return (b2 << 8) | (b1 & 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static int getSignedWord (byte[] buffer, int ptr)
|
|
||||||
// {
|
|
||||||
// short val = buffer[ptr] << 8;
|
|
||||||
// return buffer[ptr] * 256 + buffer[ptr + 1];
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static double floatValueOld (byte[] buffer, int offset)
|
public static double floatValueOld (byte[] buffer, int offset)
|
||||||
{
|
{
|
||||||
double val = 0;
|
double val = 0;
|
||||||
|
@ -409,7 +379,7 @@ public class HexFormatter
|
||||||
|
|
||||||
public static double floatValue (byte[] buffer, int ptr)
|
public static double floatValue (byte[] buffer, int ptr)
|
||||||
{
|
{
|
||||||
int exponent = buffer[ptr] & 0x7F; // biased 128
|
int exponent = buffer[ptr] & 0x7F; // biased 128
|
||||||
if (exponent == 0)
|
if (exponent == 0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user