diff options
author | Selim Gurun <sgurun@google.com> | 2013-08-15 12:46:15 -0700 |
---|---|---|
committer | Selim Gurun <sgurun@google.com> | 2013-08-16 10:44:49 -0700 |
commit | 30d4e1f3d81ad9f7a1aa14ce6d2ceb5df56c15cd (patch) | |
tree | cbc207d6c20d4e9a2bd1e93a0da42892c5a38c5a /cpp/src/sfntly/port/memory_input_stream.h | |
parent | 3411e4b64ffdd563770c4cf99615739f8d276ba0 (diff) | |
download | sfntly-30d4e1f3d81ad9f7a1aa14ce6d2ceb5df56c15cd.tar.gz |
Adding Sfntly library for printing supportandroid-sdk-4.4.2_r1.0.1android-sdk-4.4.2_r1android-cts-4.4_r4android-cts-4.4_r1android-4.4w_r1android-4.4_r1.2.0.1android-4.4_r1.2android-4.4_r1.1.0.1android-4.4_r1.1android-4.4_r1.0.1android-4.4_r1android-4.4_r0.9android-4.4_r0.8android-4.4_r0.7android-4.4.4_r2.0.1android-4.4.4_r2android-4.4.4_r1.0.1android-4.4.4_r1android-4.4.3_r1.1.0.1android-4.4.3_r1.1android-4.4.3_r1.0.1android-4.4.3_r1android-4.4.2_r2.0.1android-4.4.2_r2android-4.4.2_r1.0.1android-4.4.2_r1android-4.4.1_r1.0.1android-4.4.1_r1kitkat-wearkitkat-releasekitkat-mr2.2-releasekitkat-mr2.1-releasekitkat-mr2-releasekitkat-mr1.1-releasekitkat-mr1-releasekitkat-devkitkat-cts-releasekitkat-cts-dev
Bug: 10314402
Change-Id: I0f4b024d5c6ef47f7aedcecbb220e4f8a7fc8f16
Diffstat (limited to 'cpp/src/sfntly/port/memory_input_stream.h')
-rwxr-xr-x | cpp/src/sfntly/port/memory_input_stream.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/cpp/src/sfntly/port/memory_input_stream.h b/cpp/src/sfntly/port/memory_input_stream.h new file mode 100755 index 0000000..bc861c3 --- /dev/null +++ b/cpp/src/sfntly/port/memory_input_stream.h @@ -0,0 +1,57 @@ +/* + * Copyright 2011 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SFNTLY_CPP_SRC_SFNTLY_PORT_MEMORY_INPUT_STREAM_H_ +#define SFNTLY_CPP_SRC_SFNTLY_PORT_MEMORY_INPUT_STREAM_H_ + +#include <stdio.h> + +#include "sfntly/port/input_stream.h" + +namespace sfntly { + +class MemoryInputStream : public PushbackInputStream { + public: + MemoryInputStream(); + virtual ~MemoryInputStream(); + + // InputStream methods + virtual int32_t Available(); + virtual void Close(); + virtual void Mark(int32_t readlimit); + virtual bool MarkSupported(); + virtual int32_t Read(); + virtual int32_t Read(ByteVector* b); + virtual int32_t Read(ByteVector* b, int32_t offset, int32_t length); + virtual void Reset(); + virtual int64_t Skip(int64_t n); + + // PushbackInputStream methods + virtual void Unread(ByteVector* b); + virtual void Unread(ByteVector* b, int32_t offset, int32_t length); + + // Own methods + virtual bool Attach(const byte_t* buffer, size_t length); + + private: + const byte_t* buffer_; + size_t position_; + size_t length_; +}; + +} // namespace sfntly + +#endif // SFNTLY_CPP_SRC_SFNTLY_PORT_MEMORY_INPUT_STREAM_H_ |