mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-15 19:29:45 +00:00
31 lines
676 B
Java
31 lines
676 B
Java
|
package com.bytezone.diskbrowser.applefile;
|
||
|
|
||
|
import com.bytezone.diskbrowser.HexFormatter;
|
||
|
|
||
|
public class Charset extends AbstractFile
|
||
|
{
|
||
|
public Charset (String name, byte[] buffer)
|
||
|
{
|
||
|
super (name, buffer);
|
||
|
}
|
||
|
|
||
|
public String getText ()
|
||
|
{
|
||
|
StringBuilder text = new StringBuilder ();
|
||
|
for (int i = 0; i < buffer.length; i += 8)
|
||
|
{
|
||
|
for (int line = 7; line >= 0; line--)
|
||
|
{
|
||
|
int value = HexFormatter.intValue (buffer[i + line]);
|
||
|
for (int bit = 0; bit < 8; bit++)
|
||
|
{
|
||
|
text.append ((value & 0x01) == 1 ? "X" : ".");
|
||
|
value >>= 1;
|
||
|
}
|
||
|
text.append ("\n");
|
||
|
}
|
||
|
text.append ("\n");
|
||
|
}
|
||
|
return text.toString ();
|
||
|
}
|
||
|
}
|