00001 /* 00002 * OctetArrayReadBuffer.hpp 00003 * 00004 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_OCTET_ARRAY_READ_BUFFER_HPP 00017 #define COH_OCTET_ARRAY_READ_BUFFER_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/AbstractOctetArrayReadBuffer.hpp" 00022 00023 COH_OPEN_NAMESPACE2(coherence,io) 00024 00025 class OctetArrayWriteBuffer; 00026 00027 00028 /** 00029 * A ReadBuffer on top of an octet Array. 00030 * 00031 * @author jh 2008.01.03 00032 */ 00033 class COH_EXPORT OctetArrayReadBuffer 00034 : public cloneable_spec<OctetArrayReadBuffer, 00035 extends<AbstractOctetArrayReadBuffer> > 00036 { 00037 friend class factory<OctetArrayReadBuffer>; 00038 00039 // ----- constructors --------------------------------------------------- 00040 00041 protected: 00042 /** 00043 * Construct an OctetArrayReadBuffer object from a portion of an octet 00044 * Array. 00045 * 00046 * @param vab an Array of octets 00047 * @param of the offset into the octet Array 00048 * @param cb the number of octets to extract or npos for 00049 * (vab->length - of) 00050 * @param fCopy true to make a copy of the passed in Array 00051 * 00052 * @throws IndexOutOfBoundsException if <code>of + cb</code> is 00053 * larger than <code>vab->length</code> 00054 * @throws NullPointerException if <code>vab</code> is 00055 * <code>NULL</code> 00056 */ 00057 OctetArrayReadBuffer(Array<octet_t>::View vab, size32_t of = 0, 00058 size32_t cb = npos, bool fCopy = false); 00059 00060 /** 00061 * Copy constructor. 00062 */ 00063 OctetArrayReadBuffer(const OctetArrayReadBuffer& that); 00064 00065 00066 // ----- Object interface ----------------------------------------------- 00067 00068 public: 00069 /** 00070 * {@inheritDoc} 00071 */ 00072 virtual TypedHandle<const String> toString() const; 00073 00074 00075 // ----- internal methods ----------------------------------------------- 00076 00077 protected: 00078 /** 00079 * Allow the length to be modified. This method is provided for use by 00080 * OctetArrayWriteBuffer only, and only for read buffers that it owns. 00081 * 00082 * @param cb the new length 00083 */ 00084 virtual void updateLength(size32_t cb); 00085 00086 /** 00087 * {@inheritDoc} 00088 */ 00089 virtual ReadBuffer::View instantiateReadBuffer(size32_t of, 00090 size32_t cb) const; 00091 00092 00093 // ----- friends -------------------------------------------------------- 00094 00095 friend class OctetArrayWriteBuffer; 00096 }; 00097 00098 COH_CLOSE_NAMESPACE2 00099 00100 #endif // COH_OCTET_ARRAY_READ_BUFFER_HPP