Microsoft SDK for Java

com.ms.io Package Overview

Microsoft Packages Overview

The com.ms.io package contains a variety of classes that provide access to specialized input and output operations.

This package contains the following:

Classes

Hierarchy

You can use the classes in the com.ms.io package to manipulate path strings (Path), create file dialog boxes (UserFileDialog), resolve a class with a non-system class loader (ObjectInputStreamWithLoader), and read and write from specialized input streams.

The following table lists the classes in com.ms.io that represent I/O streams.

Class Basic functionality
IntArrayOutputStream An output stream for primitive integers.
SystemInputStream An input stream that can be handed to untrusted code.
SystemOutputStream An output stream that can be handed to untrusted code.
OffsetInputStreamFilter A filter input stream that keeps track of the byte offset into the stream.

Example

The following code sample opens a file using a file dialog box, and then writes an array of bytes to the file.

import com.ms.io.UserFileDialog;             
import java.io.FileOutputStream;
import java.awt.Frame;

public class MySample
{
  // Parent represents the container of the dialog box.
  public void dbOpen(Frame parent, byte[] buffer){
    UserFileDialog db = new UserFileDialog(parent,"Open a File");
    FileOutputStream stream = db.openFileForWriting();
    try{
      stream.write(buffer);
    }
    catch(IOException e) {
      System.out.println("I/O error occurred.");
    }
  }
}                  

© 1999 Microsoft Corporation. All rights reserved. Terms of use.