source: icXML/icXML-devel/src/xercesc/internal/BinFileOutputStream.cpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 3.3 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: BinFileOutputStream.cpp 553915 2007-07-06 14:57:08Z amassari $
20 */
21
22
23// ---------------------------------------------------------------------------
24//  Includes
25// ---------------------------------------------------------------------------
26#include <xercesc/internal/BinFileOutputStream.hpp>
27#include <xercesc/util/Janitor.hpp>
28#include <icxercesc/util/PlatformUtils.hpp>
29#include <xercesc/util/XMLExceptMsgs.hpp>
30#include <icxercesc/util/XMLString.hpp>
31
32XERCES_CPP_NAMESPACE_BEGIN
33
34// ---------------------------------------------------------------------------
35//  BinFileOutputStream: Constructors and Destructor
36// ---------------------------------------------------------------------------
37BinFileOutputStream::~BinFileOutputStream()
38{
39    if (getIsOpen())
40        XMLPlatformUtils::closeFile(fSource, fMemoryManager);
41}
42
43BinFileOutputStream::BinFileOutputStream(const XMLCh*   const fileName
44                                         , MemoryManager* const manager)
45
46:fSource(XMLPlatformUtils::openFileToWrite(fileName, manager))
47,fMemoryManager(manager)
48{
49}
50
51BinFileOutputStream::BinFileOutputStream(const char*    const fileName
52                                       , MemoryManager* const manager)
53:fSource(XMLPlatformUtils::openFileToWrite(fileName, manager))
54,fMemoryManager(manager)
55{
56}
57
58// ---------------------------------------------------------------------------
59//  BinFileOutputStream: Getter methods
60// ---------------------------------------------------------------------------
61XMLFilePos BinFileOutputStream::getSize() const
62{
63    return XMLPlatformUtils::fileSize(fSource, fMemoryManager);
64}
65
66
67// ---------------------------------------------------------------------------
68//  BinFileOutputStream: Stream management methods
69// ---------------------------------------------------------------------------
70void BinFileOutputStream::reset()
71{
72    XMLPlatformUtils::resetFile(fSource, fMemoryManager);
73}
74
75
76// ---------------------------------------------------------------------------
77//  BinFileOutputStream: Implementation of the input stream interface
78// ---------------------------------------------------------------------------
79XMLFilePos BinFileOutputStream::curPos() const
80{
81    return XMLPlatformUtils::curFilePos(fSource, fMemoryManager);
82}
83
84
85void BinFileOutputStream::writeBytes( const XMLByte* const  toGo
86                                    , const XMLSize_t       maxToWrite)
87{
88    //
89    //  Write up to the maximum bytes requested.
90    // 
91
92    XMLPlatformUtils::writeBufferToFile(fSource, maxToWrite, toGo, fMemoryManager);
93}
94
95XERCES_CPP_NAMESPACE_END
Note: See TracBrowser for help on using the repository browser.