Share via


JournalReader Class

Provides read access to a Windows Journal file, returning a stream containing an XML version of the file’s contents.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public NotInheritable Class JournalReader
'Usage
Dim instance As JournalReader
public sealed class JournalReader
public ref class JournalReader sealed
public final class JournalReader
public final class JournalReader
Not applicable.

Remarks

The JournalReader class enables you to load a Journal document stream and to receive an XML stream representing the contents. You can reconstitute, display, and manipulate the ink.

Example

The following Microsoft Visual Basic® .NET example of a handler for a Click event creates an instance of the JournalReader class and uses it to read an existing Journal file.

Note

The DisplayXml method called from this example is not shown. The specific implementation of such a method is dependent on your application's needs.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
  Dim jntStream As Stream
  Dim xmlStream As Stream
  Dim jntReader As New Microsoft.Ink.JournalReader()
  Dim openFileDialog1 As New OpenFileDialog()

  ' Get the filename from the user by using a File Open dialog
  openFileDialog1.InitialDirectory = "C:\"
  openFileDialog1.Filter = _
    "Journal files (*.jnt)|*.jnt|All files (*.*)|*.*"
  openFileDialog1.FilterIndex = 1
  openFileDialog1.RestoreDirectory = True

  If openFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
    Try
      jntStream = openFileDialog1.OpenFile()

      ' Read in the Journal file
      xmlStream = jntReader.ReadFromStream(jntStream)

      ' Show the results
      DisplayXml(xmlStream)
    Catch ex As Exception
      Debug.WriteLine(ex.Message)
    Finally
      ' Clean up
      xmlStream.Close()
      jntStream.Close()
    End Try
  End If
End Sub

The following C# example of a handler for a Click event creates an instance of the JournalReader class and uses it to read an existing Journal file.

Note

The DisplayXml method called from this example is not shown. The specific implementation of such a method is dependent on your application's needs.

private void btnLoad_Click(object sender, System.EventArgs e)
{
  Stream jntStream;
  Stream xmlStream;
  Microsoft.Ink.JournalReader jntReader = new Microsoft.Ink.JournalReader();
  OpenFileDialog openFileDialog1 = new OpenFileDialog();

  // Get the filename from the user by using a File Open dialog
  openFileDialog1.InitialDirectory = "c:\\";
  openFileDialog1.Filter = 
    "Journal files (*.jnt)|*.jnt|All files (*.*)|*.*";
  openFileDialog1.FilterIndex = 1;
  openFileDialog1.RestoreDirectory = true;

  if (openFileDialog1.ShowDialog() == DialogResult.OK)
  {
    try
    {
      if ((jntStream =   openFileDialog1.OpenFile()) != null)
      {
        // Read in the Journal file
        xmlStream = jntReader.ReadFromStream(jntStream);

        // Display results
        DisplayXml(xmlStream);
      }
    }
    catch (System.Exception ex)
    {
        Debug.WriteLine(ex.Message);
    }
    finally
    {
        // Clean up
        xmlStream.Close();
        jntStream.Close();
    }
  }
}

Inheritance Hierarchy

System.Object
  Microsoft.Ink.JournalReader

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

JournalReader Members
Microsoft.Ink Namespace
ReadFromStream

Other Resources

Journal Reader GUIDs