|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.blinkenbyte.io.WindowsBlockDevice
public class WindowsBlockDevice
This class uses JNI to access block devices under Windows. Typically, the filename must begin with \\?\ for devices. An example would be "\\?\PhysicalDrive0". This class requires WindowsBlockDevice.dll
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.blinkenbyte.io.BlockDevice |
---|
BlockDevice.DriveGeometry |
Constructor Summary | |
---|---|
WindowsBlockDevice()
|
Method Summary | |
---|---|
void |
close()
Close the device. |
boolean |
getAutoSectorAlign()
Returns whether the device is set to automatically align reads/writes to sector boundaries. |
BlockDevice.DriveGeometry |
getDriveGeometry()
Returns an object describing the geometry of the device. |
long |
getFilePointer()
Returns the current pointer for read and write operations. |
int |
getSectorSize()
Returns the sector size of the device. |
int |
getSectorSizeLog()
Returns the base 2 logarithm of the sector size of the device. |
long |
length()
Returns the size in bytes of the device. |
void |
open(java.lang.String filename,
boolean allowWrite,
boolean syncWriteData,
boolean syncWriteMetaData,
boolean _sectorMode)
Open the device. |
int |
read()
Reads and returns a single byte. |
int |
read(byte[] b)
Reads bytes into the array. |
int |
read(byte[] b,
int offset,
int len)
Reads bytes into the array. |
void |
seek(long pos)
Seeks the read/write pointer to the specified position. |
void |
setAutoSectorAlign(boolean _autoSectorAlign)
Sets whether the device should automatically align read/write requests. |
void |
setSectorSize(int _sectorSize)
Sets the sector size of the device. |
int |
skipBytes(int n)
Advances the read/write pointer n bytes. |
void |
throwIfNotOpen()
|
void |
write(byte[] b)
Writes the contents of b to the device. |
void |
write(byte[] b,
int offset,
int len)
Writes len bytes to the device starting from b[offset]. |
void |
write(int b)
Writes one byte to the device. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WindowsBlockDevice()
Method Detail |
---|
public void close() throws java.io.IOException
BlockDevice
close
in interface BlockDevice
java.io.IOException
public void open(java.lang.String filename, boolean allowWrite, boolean syncWriteData, boolean syncWriteMetaData, boolean _sectorMode) throws java.lang.Exception
BlockDevice
open
in interface BlockDevice
filename
- The filename or device name to openallowWrite
- If true, allow write access to the device.syncWriteData
- If true, always flush writes to the device.syncWriteMetaData
- If true, always flush writes of the device's metadata._sectorMode
- If true, all reads and writes should be on sector boundaries,
and exceptions should be thrown if a request is not aligned.
java.lang.Exception
public void throwIfNotOpen() throws java.io.IOException
java.io.IOException
public long getFilePointer() throws java.io.IOException
BlockDevice
getFilePointer
in interface BlockDevice
java.io.IOException
public long length() throws java.io.IOException
BlockDevice
length
in interface BlockDevice
java.io.IOException
public int read() throws java.io.IOException
BlockDevice
read
in interface BlockDevice
java.io.IOException
public int read(byte[] b) throws java.io.IOException
BlockDevice
read
in interface BlockDevice
java.io.IOException
public int read(byte[] b, int offset, int len) throws java.io.IOException
BlockDevice
read
in interface BlockDevice
java.io.IOException
public void seek(long pos) throws java.io.IOException
BlockDevice
seek
in interface BlockDevice
java.io.IOException
public int skipBytes(int n) throws java.io.IOException
BlockDevice
skipBytes
in interface BlockDevice
java.io.IOException
public void write(byte[] b) throws java.io.IOException
BlockDevice
write
in interface BlockDevice
java.io.IOException
public void write(byte[] b, int offset, int len) throws java.io.IOException
BlockDevice
write
in interface BlockDevice
java.io.IOException
public void write(int b) throws java.io.IOException
BlockDevice
write
in interface BlockDevice
java.io.IOException
public BlockDevice.DriveGeometry getDriveGeometry() throws java.lang.Exception
BlockDevice
getDriveGeometry
in interface BlockDevice
java.lang.Exception
public int getSectorSize()
BlockDevice
getSectorSize
in interface BlockDevice
public void setSectorSize(int _sectorSize) throws java.lang.Exception
BlockDevice
setSectorSize
in interface BlockDevice
java.lang.Exception
public int getSectorSizeLog()
BlockDevice
getSectorSizeLog
in interface BlockDevice
public boolean getAutoSectorAlign()
BlockDevice
getAutoSectorAlign
in interface BlockDevice
public void setAutoSectorAlign(boolean _autoSectorAlign)
BlockDevice
setAutoSectorAlign
in interface BlockDevice
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |