1

Android タブレットに接続されている USB フラッシュの最初のセクターまたは最初のバイトを読み取りたいです。

RandomAccessFile を使用する必要があることはわかっていますが、USB フラッシュのアドレスがわかりません。

ご協力いただきありがとうございます


このコードを見つけましたが、args[0] の代わりに何を入れればよいかわかりません

public class FAT16
{
public static void main(String[] args) throws IOException
{
// open file whose name is on the command line for input

RandomAccessFile file = new RandomAccessFile(args[0], "r");

// skip ahead to byte 19 (0x13 hex) where the num of sectors is stored

file.seek(0x13);

// 2-byte values are little-endian; Java is big-endian, so we
// have to read the two bytes separately and glue them together
// ourselves

int low = file.readUnsignedByte();
int high = file.readUnsignedByte();

int sectorsOnDisk = low + (high * 256);

// skip ahead to where the sectors per FAT is stored

file.seek(0x16);
low = file.readUnsignedByte();
high = file.readUnsignedByte();

int sectorsPerFAT = low + high * 256;

// skip back to where the bytes per sector is stored

file.seek(0x0b);
low = file.readUnsignedByte();
high = file.readUnsignedByte();
int bytesPerSector = low + high * 256;

// report size of disk and number of sectors per FAT

System.out.println("Disk size = " + sectorsOnDisk * bytesPerSector );
System.out.println("Sectors per FAT = " + sectorsPerFAT);
}

}

Linux では「/dev/sdaX」を使用する必要があることはわかっていますが、adnroid の場合はどうでしょうか?

4

1 に答える 1

1

Android SDK では「USB フラッシュ」はサポートされていません。デバイスの「USB フラッシュ」にアクセスするための特定のプロトコルがあるかどうかについては、デバイスの製造元にお問い合わせください。

于 2012-01-31T15:38:35.677 に答える