Skip Headers

Oracle® Data Provider for .NET Developer's Guide
Release 9.2.0.4

Part Number B10961-01
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to beginning of chapter Go to next page

Oracle.DataAccess.Types Namespace (ODP.NET Types), 18 of 19


OracleXmlStream Class

An OracleXmlStream object represents a read-only stream of XML data stored in an OracleXmlType object.

Class Inheritance

Object

  MarshalByRefObject

    Stream

      OracleXmlStream

Declaration
// C#
public sealed class OracleXmlStream : IDisposable, ICloneable
Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Example
// C#

Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

This class can only be used with Oracle9i Release 2 (9.2) and later.

See Also:

OracleXmlStream Members

OracleXmlStream members are listed in the following tables:

OracleXmlStream Constructors

The OracleXmlStream constructors are listed in Table 5-180.

Table 5-180 OracleXmlStream Constructors  
Constructor Description

OracleXmlStream Constructor

Creates an instance of an OracleXmlStream object which provides a Stream representation of the XML data stored in an OracleXmlType

OracleXmlStream Static Methods

The OracleXmlStream static methods are listed in Table 5-181.

Table 5-181 OracleXmlStream Static Methods
Methods Description

Equals

Inherited from Object (Overloaded)

OracleXmlStream Instance Properties

The OracleXmlStream instance properties are listed in Table 5-182.

Table 5-182 OracleXmlStream Instance Properties  
Properties Description

CanRead

Indicates whether the XML stream can be read

CanSeek

Indicates whether forward and backward seek operation can be performed

CanWrite

Not Supported

Connection

Indicates the OracleConnection that is used to retrieve the XML data

Length

Indicates the number of bytes in the XML stream

Position

Gets or sets the byte position within the stream

Value

Returns the XML data, starting from the first character in the stream as a string

OracleXmlStream Instance Methods

The OracleXmlStream instance methods are listed in Table 5-183.

Table 5-183 OracleXmlStream instance Methods  
Methods Description

BeginRead

Inherited from Stream

BeginWrite

Inherited from Stream

Clone

Creates a copy of an OracleXmlStream object

Close

Closes the current stream and releases any resources associated with it

Dispose

Releases resources allocated by this object

EndRead

Inherited from Stream

EndWrite

Inherited from Stream

Equals

Inherited from Object

Flush

Not Supported

GetHashCode

Inherited from Object

GetLifetimeService

Inherited from MarshalByRefObject

GetType

Inherited from Object

InitializeLifetimeService

Inherited from MarshalByRefObject

Read

Reads a specified amount from the current stream instance and populates the array buffer (Overloaded)

ReadByte

Inherited from Stream

Seek

Sets the position within the current stream and returns the new position within the current stream

SetLength

Not Supported

ToString

Inherited from Object

Write

Not Supported

WriteByte

Not Supported

See Also:

OracleXmlStream Constructor

This constructor creates an instance of an OracleXmlStream object which provides a Stream representation of the XML data stored in an OracleXmlType object.

Declaration
// C#
public OracleXmlStream(OracleXmlType xmlType);
Parameters
Remarks

The OracleXmlStream implicitly uses the OracleConnection object from the OracleXmlType object from which it was constructed.

See Also:

OracleXmlStream Static Methods

The OracleXmlStream static methods are listed in Table 5-184.

Table 5-184 OracleXmlStream Static Methods
Methods Description

Equals

Inherited from Object (Overloaded)

See Also:

OracleXmlStream Instance Properties

The OracleXmlStream instance properties are listed in Table 5-185.

Table 5-185 OracleXmlStream Instance Properties  
Properties Description

CanRead

Indicates whether the XML stream can be read

CanSeek

Indicates whether forward and backward seek operation can be performed

CanWrite

Not Supported

Connection

Indicates the OracleConnection that is used to retrieve the XML data

Length

Indicates the number of bytes in the XML stream

Position

Gets or sets the byte position within the stream

Value

Returns the XML data, starting from the first character in the stream as a string

See Also:

CanRead

Overrides Stream

This property indicates whether the XML stream can be read.

Declaration
// C#
public override bool CanRead{get;}
Property Value

If the XML stream is can be read, returns true; otherwise, returns false.

See Also:

CanSeek

Overrides Stream

This property indicates whether forward and backward seek operation can be performed.

Declaration
// C#
public override bool CanSeek{get;}
Property Value

If forward and backward seek operations can be performed, this property returns true. Otherwise, returns false.

See Also:

Connection

This instance property indicates the OracleConnection that is used to retrieve the XML data.

Declaration
// C#
public OracleConnection Connection {get;}

Property Value

An OracleConnection.

Exceptions

ObjectDisposedException - The object is already disposed.

See Also:

Length

Overrides Stream

This property indicates the number of bytes in the XML stream.

Declaration
// C#
public override Int64 Length{get;}
Property Value

An Int64 value representing the number of bytes in the XML stream. An empty stream has a length of 0 bytes.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

See Also:

Position

Overrides Stream

This property gets or sets the byte position within the stream.

Declaration
// C#
public override Int64 Position{get; set;}
Property Value

An Int64 that indicates the current position in the stream.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - The Position is less than 0.

Remarks

The beginning of the stream is represented by position 0. Seeking to any location beyond the length of the stream is supported.

See Also:

Value

This property returns the XML data, starting from the first character of the stream as a string.

Declaration
// C#
public string Value{get; set;}
Property Value

A string.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

The value of Position is neither used nor changed by using this property.

The maximum length of the string that can be returned by this property is 2 GB.

See Also:

OracleXmlStream Instance Methods

The OracleXmlStream instance methods are listed in Table 5-186.

Table 5-186 OracleXmlStream Instance Methods  
Methods Description

BeginRead

Inherited from Stream

BeginWrite

Inherited from Stream

Clone

Creates a copy of an OracleXmlStream object

Close

Closes the current stream and releases any resources associated with it

Dispose

Releases resources allocated by this object

EndRead

Inherited from Stream

EndWrite

Inherited from Stream

Equals

Inherited from Object

Flush

Not Supported

GetHashCode

Inherited from Object

GetLifetimeService

Inherited from MarshalByRefObject

GetType

Inherited from Object

InitializeLifetimeService

Inherited from MarshalByRefObject

Read

Reads a specified amount from the current XML stream instance and populates the array buffer (Overloaded)

ReadByte

Inherited from Stream

Seek

Sets the position within the current stream and returns the new position within the current stream

SetLength

Not Supported

ToString

Inherited from Object

Write

Not Supported

WriteByte

Not Supported

See Also:

Clone

This method creates a copy of an OracleXmlStream object.

Declaration
// C#
public object Clone();
Return Value

An OracleXmlStream object.

Implements

ICloneable

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

The cloned object has the same property values as that of the object being cloned.

Example
// C#
...
//Need a proper casting for the return value when cloned
OracleXmlStream oraXmlStream_cloned = (OracleXmlStream) oraXmlStream.Clone();
...

See Also:

Close

Overrides Stream

This method closes the current stream and releases any resources associated with it.

Declaration
// C#
public override void Close();

See Also:

Dispose

This public method releases resources allocated by this object.

Declaration
// C#
public void Dispose();
Implements

IDisposable

Remarks

The object cannot be reused after being disposed. Although some properties can still be accessed, their values cannot be accountable. Since resources are freed, method calls can lead to exceptions.

See Also:

Read

This method reads a specified amount from the current XML stream instance and populates the array buffer.

Overload List:

Read(byte[ ], int, int)

Overrides Stream

This method reads a specified amount of unicode bytes from the current instance, advances the position within the stream, and populates the byte array buffer.

Declaration
// C#
public override int Read(byte[ ] buffer, int offset, int count);
Parameters
Return Value

The number of unicode bytes read into the given byte[] buffer or 0 if the end of the stream has been reached.

Remarks

This method reads a maximum of count bytes from the current stream and stores them in buffer beginning at offset. The current position within the stream is advanced by the number of bytes read. However, if an exception occurs, the current position within the stream remains unchanged.

The XML data is read starting from the position specified by the Position property.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

See Also:

Read(char[ ], int, int)

Overrides Stream

This method reads a specified amount of characters from the current instance, advances the position within the stream, and populates the character array buffer.

Declaration
// C#
public override int Read(char[ ] buffer, int offset, int count);
Parameters
Return Value

The return value indicates the number of characters read from the stream or 0 if the end of the stream has been reached.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

This method requires that the Position on the stream instance be zero or an even number.

The XML data is read starting from the position specified by the Position property.

See Also:

Seek

Overrides Stream.

This method sets the position within the current stream and returns the new position within the current stream.

Declaration
// C#
public long Seek(long offset, SeekOrigin origin);
Parameters
Return Value

The new Position within the current stream.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object

Remarks

Use the CanSeek property to determine whether the current instance supports seeking. Seeking to any location beyond the length of the stream is supported.

See Also:


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2002, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents
Go To Index
Index