JournalReader.ReadFromStream Method
Takes a stream to a Journal Note file and returns an XML stream representing the contents of the document.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.JournalReader (in Microsoft.Ink.JournalReader.dll)
Syntax
'Declaration
Public Shared Function ReadFromStream ( _
inputStream As Stream _
) As Stream
'Usage
Dim inputStream As Stream
Dim returnValue As Stream
returnValue = JournalReader.ReadFromStream(inputStream)
public static Stream ReadFromStream(
Stream inputStream
)
public:
static Stream^ ReadFromStream(
Stream^ inputStream
)
public static function ReadFromStream(
inputStream : Stream
) : Stream
Parameters
- inputStream
Type: System.IO.Stream
Return Value
Type: System.IO.Stream
Returns a Stream object containing the XML created by reading the Journal Note file.
Remarks
Stream objects are used to avoid direct access to the file system and to allow choice in which XML parsing method to use.
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(); }
}
}
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