org.virtualbox_6_1
Class IMediumIO

java.lang.Object
  extended by org.virtualbox_6_1.IUnknown
      extended by org.virtualbox_6_1.IMediumIO

public class IMediumIO
extends IUnknown

The IMediumIO interface is used to access and modify the content of a medium. It is returned byIMedium.openForIO(Boolean,String). Interface ID: {E4B301A9-5F86-4D65-AD1B-87CA284FB1C8}


Field Summary
 
Fields inherited from class org.virtualbox_6_1.IUnknown
obj, objMgr, port
 
Constructor Summary
IMediumIO(java.lang.String wrapped, org.virtualbox_6_1.ObjectRefManager objMgr, org.virtualbox_6_1.jaxws.VboxPortType port)
           
 
Method Summary
 void close()
          Explictly close the medium I/O rather than waiting for garbage collection and the destructor.
 IProgress convertToStream(java.lang.String format, java.util.List<MediumVariant> variant, java.lang.Long bufferSize, Holder<IDataStream> stream)
          Converts the currently opened image into a stream of the specified image type/variant.
 void formatFAT(java.lang.Boolean quick)
          Formats the medium as FAT.
 IVFSExplorer getExplorer()
          Returns the virtual file system explorer for the medium.
 IMedium getMedium()
          The open medium.
 java.lang.Boolean getWritable()
          Whether the medium can be written to.
 void initializePartitionTable(PartitionTableType format, java.lang.Boolean wholeDiskInOneEntry)
          Writes an empty partition table to the disk.
static IMediumIO queryInterface(IUnknown obj)
           
 byte[] read(java.lang.Long offset, java.lang.Long size)
          Read data from the medium.
 java.lang.Long write(java.lang.Long offset, byte[] data)
          Write data to the medium.
 
Methods inherited from class org.virtualbox_6_1.IUnknown
getObjMgr, getRemoteWSPort, getWrapped, releaseRemote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IMediumIO

public IMediumIO(java.lang.String wrapped,
                 org.virtualbox_6_1.ObjectRefManager objMgr,
                 org.virtualbox_6_1.jaxws.VboxPortType port)
Method Detail

getMedium

public IMedium getMedium()
The open medium.

Returns:
org.virtualbox_6_1.IMedium

getWritable

public java.lang.Boolean getWritable()
Whether the medium can be written to. (It can always be read from.)

Returns:
Boolean

getExplorer

public IVFSExplorer getExplorer()
Returns the virtual file system explorer for the medium. This will attempt to recognize the format of the medium content and present it as a virtual directory structure to the API user. A FAT floppy image will be represented will a single root subdir 'fat12' that gives access to the file system content. A ISO-9660 image will have one subdir in the root for each format present in the image, so the API user can select which data view to access (iso9660, rockridge, joliet, udf, hfs, ...). A partitioned harddisk image will have subdirs for each partition. The the filesystem content of each partition can be accessed thru the subdirs if we have a file system interpreter for it. There will also be raw files for each subdirectory, to provide a simple way of accessing raw partition data from an API client. Please note that the explorer may show inconsistent information if the API user modifies the raw image content after it was opened.

Returns:
org.virtualbox_6_1.IVFSExplorer

queryInterface

public static IMediumIO queryInterface(IUnknown obj)

read

public byte[] read(java.lang.Long offset,
                   java.lang.Long size)
Read data from the medium.

Parameters:
offset - The byte offset into the medium to start reading at.
size - How many bytes to try read.
Returns:
Array of data read. This may be shorter than the specified size.

write

public java.lang.Long write(java.lang.Long offset,
                            byte[] data)
Write data to the medium.

Parameters:
offset - The byte offset into the medium to start reading at.
data - Array of data to write.
Returns:
How many bytes were actually written.

formatFAT

public void formatFAT(java.lang.Boolean quick)
Formats the medium as FAT. Generally only useful for floppy images as no partition table will be created.

Parameters:
quick - Quick format it when set.

initializePartitionTable

public void initializePartitionTable(PartitionTableType format,
                                     java.lang.Boolean wholeDiskInOneEntry)
Writes an empty partition table to the disk.

Parameters:
format - The partition table format.
wholeDiskInOneEntry - When true a partition table entry for the whole disk is created. Otherwise the partition table is empty.

convertToStream

public IProgress convertToStream(java.lang.String format,
                                 java.util.List<MediumVariant> variant,
                                 java.lang.Long bufferSize,
                                 Holder<IDataStream> stream)
Converts the currently opened image into a stream of the specified image type/variant. It is sufficient to open the image in read-only mode. Only few types and variants are supported due to the inherent restrictions of the output style.

Parameters:
format - Identifier of the storage format to use for output.
variant - The partition table format.
bufferSize - Requested buffer size (in bytes) for efficient conversion. Sizes which are too small or too large are silently truncated to suitable values. Tens to hundreds of Megabytes are a good choice.
stream - Data stream object for reading the target image.
Returns:
Progress object to track the operation completion. Expected result codes:
VBOX_E_NOT_SUPPORTEDThe requested format/variant combination cannot handle stream output.
VBOX_E_FILE_ERRORAn error occurred during the conversion.

close

public void close()
Explictly close the medium I/O rather than waiting for garbage collection and the destructor. This will wait for any pending reads and writes to complete and then close down the I/O access without regard for open explorer instances or anything like that.