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.JournalReader (in Microsoft.Ink.JournalReader.dll)

Syntax

'Declaration
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public NotInheritable Class JournalReader
'Usage
Dim instance As JournalReader
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public sealed class JournalReader
[PermissionSetAttribute(SecurityAction::Demand, Name = L"FullTrust")]
public ref class JournalReader sealed
public final class JournalReader

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.

Examples

In this example, a selected Journal file is converted to XML and displayed to the Console device.

Dim FD As OpenFileDialog = New OpenFileDialog()
FD.Filter = "Journal files(*.jnt)|*.jnt" 
If FD.ShowDialog() = Windows.Forms.DialogResult.OK Then 
    Dim jntStream As Stream = Nothing 
    Dim xmlStream As Stream = Nothing 
    Try
        jntStream = FD.OpenFile()
        If Not IsNothing(jntStream) Then
            xmlStream = JournalReader.ReadFromStream(jntStream)
            Dim xmlDoc As XmlDocument = New XmlDocument()
            xmlDoc.Load(xmlStream)
            Dim xmlTW As XmlTextWriter = New XmlTextWriter(Console.Out)
            xmlTW.Formatting = Formatting.Indented
            xmlDoc.WriteTo(xmlTW)
            xmlTW.Flush()
        End If 

    Catch ex As Exception
        ' handle exception 
    Finally 
        If Not IsNothing(jntStream) Then
            jntStream.Close()
        End If 
        If Not IsNothing(xmlStream) Then
            xmlStream.Close()
        End If 
    End Try 

End If
OpenFileDialog FD = new OpenFileDialog();
FD.Filter = "Journal files(*.jnt)|*.jnt";
if (FD.ShowDialog() == DialogResult.OK)
{
    Stream jntStream = null;
    Stream xmlStream = null;
    try
    {
        if ((jntStream = FD.OpenFile()) != null)
        {
            xmlStream = JournalReader.ReadFromStream(jntStream);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlStream);
            XmlTextWriter xmlTW = new XmlTextWriter(Console.Out);
            xmlTW.Formatting = Formatting.Indented;
            xmlDoc.WriteTo(xmlTW);
            xmlTW.Flush();
        }
    }
    catch
    {
        // handle exception
    }
    finally
    {
        if (null != jntStream) { jntStream.Close(); }
        if (null != xmlStream) { xmlStream.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 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

JournalReader Members

Microsoft.Ink Namespace

ReadFromStream

Other Resources

Journal Reader GUIDs