drive

How to access specific raw data on disk from java

瘦欲@ 提交于 2019-11-27 00:51:49
I'm trying to use the following code to access one byte with offset of 50 bytes in a raw disk. randomAccessFile = new RandomAccessFile("C:", "r"); randomAccessFile.seek(50); byte[] buffer = new byte[1]; randomAccessFile.read(buffer); But all what I get is the following error: java.io.FileNotFoundException: C: (Acceso denegado) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:98) at pru.lseek.main(lseek.java:26) Is there any way to access a precise byte in a drive from java?

What is the best way to map windows drives using Python?

白昼怎懂夜的黑 提交于 2019-11-26 17:30:41
问题 What is the best way to map a network share to a windows drive using Python? This share also requires a username and password. 回答1: I'd go with IronPython and this article : Mapping a Drive Letter Programmatically. Or you could use the Win32 API directly. 回答2: Building off of @Anon's suggestion: # Drive letter: M # Shared drive path: \\shared\folder # Username: user123 # Password: password import subprocess # Disconnect anything on M subprocess.call(r'net use m: /del', shell=True) # Connect