⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swibufferedinputstream.hpp

📁 OSB-PIK-OpenVXI-3.0.0源代码 “中国XML论坛 - 专业的XML技术讨论区--XML在语音技术中的应用”
💻 HPP
字号:
#ifndef SWIBUFFEREDINPUTSTREAM_HPP #define SWIBUFFEREDINPUTSTREAM_HPP  /****************License************************************************  *  * Copyright 2000-2003.  ScanSoft, Inc.      *  * Use of this software is subject to notices and obligations set forth   * in the SpeechWorks Public License - Software Version 1.2 which is   * included with this software.   *  * ScanSoft is a registered trademark of ScanSoft, Inc., and OpenSpeech,   * SpeechWorks and the SpeechWorks logo are registered trademarks or   * trademarks of SpeechWorks International, Inc. in the United States   * and other countries.  *  ***********************************************************************/  #include "SWIfilterInputStream.hpp"  class SWIUTIL_API_CLASS SWIbufferedInputStream: public SWIfilterInputStream {   // ................. CONSTRUCTORS, DESTRUCTOR  ............   //   // ------------------------------------------------------------   /**    * Provides buffering for non-buffered stream.    *    * @param stream The stream that is being wrapped.    * @param bufSize the size of the internal buffer.  This is also the size that will be used to call    * the stream's read operation.    * @param lookAhead The amount of look ahead characters that can be looked further.    * @param ownStream  If <code>true</code>, then the stream is deleted when this reader is deleted.    *    **/  public:   SWIbufferedInputStream(SWIinputStream * stream,             int bufSize = 1024,             int lookAhead = 10,             bool ownStream = true);    /**    * Destructor.    **/  public:   virtual ~SWIbufferedInputStream();    /**    * Reads one character from the stream.     * Returns either a positive number that can be cast to a char or a negative    * number representing an error.  See SWIstream.hpp for error codes.    **/  public:   virtual int read();    /**    * Reads the specified number of bytes into the specified buffer.    *    * Returns the number of bytes stored in the buffer.    **/  public:   virtual int readBytes(void *buffer, int bufSize);    /**    * Reads a line of text.  A line is considered to be terminated by any one    * of a line feed ('\n'), a carriage return ('\r'), or a carriage return    * followed immediately by a linefeed.  The carriage return and line feed    * are extracted from the stream but not stored.    *    * returns the number of characters in the string, or a negative number    * representing the cause of the error. See SWIstream.hpp for error codes.    * Note that function is lost in the case where the value returned is exactly    * <code>bufSize - 1</code>.  In this case, it is impossible to know whether the reading stopped    * because of a line-termination or because the buffer is full.    *    **/  public:   virtual int readLine(char *buffer, int bufSize);    /**    * Reads a line of text and store the result into an OutputStream.    *    * Returns the number of characters that have been successfully put into the stream.    **/   virtual int readLine(SWIoutputStream& out);    /**    * Looks at the stream for look-ahead character.    *    * @param offset The offset compared to the current read position in the stream.  A value of 0 means    * the character that would be returned by the next read().    *    * @return    Returns either a positive number that can be cast to a char or a negative    * number representing an error.  See SWIstream.hpp for error codes.    **/   virtual int peek(int offset = 0) const;    virtual bool isBuffered() const;    virtual int getLookAhead() const;   public:   virtual Result close();   public:   virtual Result waitReady(long timeoutMs = -1);    /**    * Disabled copy constructor.    **/  private:   SWIbufferedInputStream(const SWIbufferedInputStream&);    /**    * Disabled assignment operator.    **/  private:   SWIbufferedInputStream& operator=(const SWIbufferedInputStream&);   private:   int fillBuffer(int lowBound = 0);   private:   SWIinputStream *_stream;   int _readSize;   int _lookAhead;   bool _ownStream;   unsigned char *_buffer;   unsigned char * _end;   unsigned char *_pos;   bool _eofSeen; }; #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -