Xalan-C++ API Reference  1.12.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
xalanc::XalanOutputStream Class Referenceabstract

#include <xalanc/PlatformSupport/XalanOutputStream.hpp>

Inheritance diagram for xalanc::XalanOutputStream:
[legend]

Classes

class  TranscoderInternalFailureException
 
class  TranscodingException
 
class  UnsupportedEncodingException
 
class  XalanOutputStreamException
 

Public Types

enum  { eDefaultBufferSize = 512u, eDefaultTranscoderBlockSize = 1024u }
 
typedef XalanVector< XalanDOMChar > BufferType
 
typedef XalanVector< char > TranscodeVectorType
 
typedef XalanTranscodingServices::size_type size_type
 

Public Member Functions

 XalanOutputStream (MemoryManager &theManager, size_type theBufferSize=eDefaultBufferSize, size_type theTranscoderBlockSize=eDefaultTranscoderBlockSize, bool fThrowTranscodeException=true)
 Constructor. More...
 
virtual ~XalanOutputStream ()
 
MemoryManager & getMemoryManager ()
 
virtual void newline ()
 Write the appropriate newline character(s) to the stream. More...
 
virtual const XalanDOMChar * getNewlineString () const
 Get the string which is appropriate for inserting a line feed in the stream. More...
 
void flushBuffer ()
 Flush the stream's transcoding buffer, but do not request the implementation class to flush its buffer. More...
 
void flush ()
 Flush the stream's buffer. More...
 
void write (char theChar)
 Write a character to the output stream. More...
 
void write (XalanDOMChar theChar)
 Write a wide character to the output stream. More...
 
void write (const char *theBuffer)
 Write a null-terminated string to the output file. More...
 
void write (const XalanDOMChar *theBuffer)
 Write a null-terminated wide string to the output file. More...
 
void write (const char *theBuffer, size_type theBufferLength)
 Write a specified number of characters to the output stream. More...
 
void write (const XalanDOMChar *theBuffer, size_type theBufferLength)
 Write a specified number of characters to the output stream. More...
 
const XalanDOMStringgetOutputEncoding () const
 Get the output encoding for the stream. More...
 
void setOutputEncoding (const XalanDOMString &theEncoding)
 Set the output encoding for the stream. More...
 
bool canTranscodeTo (XalanUnicodeChar theChar) const
 Determine if a given value can be represented in the output encoding. More...
 
const XalanOutputTranscodergetTranscoder () const
 
bool getThrowTranscodeException () const
 Set the flag that indicates whether a transcoding error should throw an exception. More...
 
void setThrowTranscodeException (bool flag)
 Set the flag that indicates whether a transcoding error should throw an exception. More...
 
void setBufferSize (size_type theBufferSize)
 Set the size of the output buffer. More...
 

Static Public Member Functions

static const XalanDOMChar * defaultNewlineString ()
 
static XalanDOMStringformatMessage (const XalanDOMString &theMessage, int theErrorCode, XalanDOMString &theBuffer)
 

Protected Member Functions

void transcode (const XalanDOMChar *theBuffer, size_type theBufferLength, TranscodeVectorType &theDestination)
 Transcode a wide string. More...
 
virtual void writeData (const char *theBuffer, size_type theBufferLength)=0
 Write the data in the buffer. More...
 
virtual void doFlush ()=0
 Flush the stream. More...
 

Static Protected Attributes

static const XalanDOMChar s_nlString []
 
static const XalanDOMChar s_nlCRString []
 
static const XalanDOMString::size_type s_nlStringLength
 
static const XalanDOMString::size_type s_nlCRStringLength
 

Detailed Description

Definition at line 49 of file XalanOutputStream.hpp.

Member Typedef Documentation

◆ BufferType

Definition at line 55 of file XalanOutputStream.hpp.

◆ size_type

Definition at line 57 of file XalanOutputStream.hpp.

◆ TranscodeVectorType

Definition at line 56 of file XalanOutputStream.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eDefaultBufferSize 
eDefaultTranscoderBlockSize 

Definition at line 53 of file XalanOutputStream.hpp.

Constructor & Destructor Documentation

◆ XalanOutputStream()

xalanc::XalanOutputStream::XalanOutputStream ( MemoryManager &  theManager,
size_type  theBufferSize = eDefaultBufferSize,
size_type  theTranscoderBlockSize = eDefaultTranscoderBlockSize,
bool  fThrowTranscodeException = true 
)
explicit

Constructor.

Parameters
theBufferSizethe size of the transcoding buffer
theTranscoderBlockSizethe size of the block used by the transcoder
fThrowTranscodeExceptionIf true, an error transcoding will result in an exception being thrown.

◆ ~XalanOutputStream()

virtual xalanc::XalanOutputStream::~XalanOutputStream ( )
virtual

Member Function Documentation

◆ canTranscodeTo()

bool xalanc::XalanOutputStream::canTranscodeTo ( XalanUnicodeChar  theChar) const

Determine if a given value can be represented in the output encoding.

Returns
true if the value can be represented, and false if not.

◆ defaultNewlineString()

static const XalanDOMChar* xalanc::XalanOutputStream::defaultNewlineString ( )
inlinestatic

Definition at line 83 of file XalanOutputStream.hpp.

◆ doFlush()

virtual void xalanc::XalanOutputStream::doFlush ( )
protectedpure virtual

◆ flush()

void xalanc::XalanOutputStream::flush ( )
inline

Flush the stream's buffer.

Definition at line 116 of file XalanOutputStream.hpp.

◆ flushBuffer()

void xalanc::XalanOutputStream::flushBuffer ( )

Flush the stream's transcoding buffer, but do not request the implementation class to flush its buffer.

◆ formatMessage()

static XalanDOMString& xalanc::XalanOutputStream::formatMessage ( const XalanDOMString theMessage,
int  theErrorCode,
XalanDOMString theBuffer 
)
static

◆ getMemoryManager()

MemoryManager& xalanc::XalanOutputStream::getMemoryManager ( )
inline

Definition at line 77 of file XalanOutputStream.hpp.

◆ getNewlineString()

virtual const XalanDOMChar* xalanc::XalanOutputStream::getNewlineString ( ) const
virtual

Get the string which is appropriate for inserting a line feed in the stream.

Referenced by xalanc::XalanFormatterWriter::NewLineWriterFunctor< WriterType >::NewLineWriterFunctor(), and xalanc::XalanFormatterWriter::XalanFormatterWriter().

◆ getOutputEncoding()

const XalanDOMString& xalanc::XalanOutputStream::getOutputEncoding ( ) const
inline

Get the output encoding for the stream.

Returns
The encoding name

Definition at line 220 of file XalanOutputStream.hpp.

Referenced by xalanc::XalanFormatterWriter::throwUnrepresentableCharacterException().

◆ getThrowTranscodeException()

bool xalanc::XalanOutputStream::getThrowTranscodeException ( ) const
inline

Set the flag that indicates whether a transcoding error should throw an exception.

The default is to throw an exception. If this flag is false, and and an error occurs transcoding, then data will likely be lost.

Returns
the value of the flag.

Definition at line 259 of file XalanOutputStream.hpp.

◆ getTranscoder()

const XalanOutputTranscoder* xalanc::XalanOutputStream::getTranscoder ( ) const
inline

Definition at line 244 of file XalanOutputStream.hpp.

◆ newline()

virtual void xalanc::XalanOutputStream::newline ( )
virtual

Write the appropriate newline character(s) to the stream.

◆ setBufferSize()

void xalanc::XalanOutputStream::setBufferSize ( size_type  theBufferSize)

Set the size of the output buffer.

Parameters
theBufferSizeThe buffer size.

◆ setOutputEncoding()

void xalanc::XalanOutputStream::setOutputEncoding ( const XalanDOMString theEncoding)

Set the output encoding for the stream.

Parameters
theEncodingThe encoding name

◆ setThrowTranscodeException()

void xalanc::XalanOutputStream::setThrowTranscodeException ( bool  flag)
inline

Set the flag that indicates whether a transcoding error should throw an exception.

The default is to throw an exception. If this flag is false, and and an error occurs transcoding, then data will likely be lost.

Parameters
thenew value of the flag.

Definition at line 274 of file XalanOutputStream.hpp.

◆ transcode()

void xalanc::XalanOutputStream::transcode ( const XalanDOMChar *  theBuffer,
size_type  theBufferLength,
TranscodeVectorType theDestination 
)
protected

Transcode a wide string.

Parameters
theBufferThe string to transcode.
theBufferLengthThe length of the string.
theDestinationThe destination vector.

◆ write() [1/6]

void xalanc::XalanOutputStream::write ( char  theChar)
inline

Write a character to the output stream.

The character will not be transcoded.

Parameters
theCharthe character to write

Definition at line 130 of file XalanOutputStream.hpp.

◆ write() [2/6]

void xalanc::XalanOutputStream::write ( const char *  theBuffer)
inline

Write a null-terminated string to the output file.

The character will not be transcoded. The caller is responsible for making sure the buffer is flushed before calling this member function.

Parameters
theBuffercharacter buffer to write

Definition at line 162 of file XalanOutputStream.hpp.

References xalanc::length().

◆ write() [3/6]

void xalanc::XalanOutputStream::write ( const char *  theBuffer,
size_type  theBufferLength 
)
inline

Write a specified number of characters to the output stream.

The string will not be transcoded. The caller is responsible for making sure the buffer is flushed before calling this member function.

Parameters
theBuffercharacter buffer to write
theBufferLengthnumber of characters to write

Definition at line 191 of file XalanOutputStream.hpp.

◆ write() [4/6]

void xalanc::XalanOutputStream::write ( const XalanDOMChar *  theBuffer)
inline

Write a null-terminated wide string to the output file.

The string will be transcoded, if an output encoding is specified.

Parameters
theBuffercharacter buffer to write

Definition at line 177 of file XalanOutputStream.hpp.

References xalanc::length().

◆ write() [5/6]

void xalanc::XalanOutputStream::write ( const XalanDOMChar *  theBuffer,
size_type  theBufferLength 
)

Write a specified number of characters to the output stream.

The string will be transcoded, if an output encoding is specified.

Parameters
theBuffercharacter buffer to write
theBufferLengthnumber of characters to write

◆ write() [6/6]

void xalanc::XalanOutputStream::write ( XalanDOMChar  theChar)
inline

Write a wide character to the output stream.

The character will be transcoded, if an output encoding is specified.

Parameters
theCharthe character to write

Definition at line 142 of file XalanOutputStream.hpp.

◆ writeData()

virtual void xalanc::XalanOutputStream::writeData ( const char *  theBuffer,
size_type  theBufferLength 
)
protectedpure virtual

Write the data in the buffer.

Parameters
theBufferThe data to write
theBufferLengthThe length of theBuffer.

Implemented in xalanc::XalanFileOutputStream, xalanc::XalanStdOutputStream, xalanc::XalanFStreamOutputStream, xalanc::XalanTransformerOutputStream, and xalanc::XalanNullOutputStream.

Member Data Documentation

◆ s_nlCRString

const XalanDOMChar xalanc::XalanOutputStream::s_nlCRString[]
staticprotected

Definition at line 441 of file XalanOutputStream.hpp.

◆ s_nlCRStringLength

const XalanDOMString::size_type xalanc::XalanOutputStream::s_nlCRStringLength
staticprotected

Definition at line 444 of file XalanOutputStream.hpp.

◆ s_nlString

const XalanDOMChar xalanc::XalanOutputStream::s_nlString[]
staticprotected

Definition at line 440 of file XalanOutputStream.hpp.

◆ s_nlStringLength

const XalanDOMString::size_type xalanc::XalanOutputStream::s_nlStringLength
staticprotected

Definition at line 443 of file XalanOutputStream.hpp.


The documentation for this class was generated from the following file: