• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef IMG_UTILS_OUTPUT_H
18 #define IMG_UTILS_OUTPUT_H
19 
20 #include <cutils/compiler.h>
21 #include <utils/Errors.h>
22 #include <stdint.h>
23 
24 namespace android {
25 namespace img_utils {
26 
27 /**
28  * Utility class used to output bytes.
29  */
30 class ANDROID_API Output {
31     public:
32         virtual ~Output();
33 
34         /**
35          * Open this Output.
36          *
37          * Returns OK on success, or a negative error code.
38          */
39         virtual status_t open();
40 
41         /**
42          * Write bytes from the given buffer.  The number of bytes given in the count
43          * argument will be written.  Bytes will be written from the given buffer starting
44          * at the index given in the offset argument.
45          *
46          * Returns OK on success, or a negative error code.
47          */
48         virtual status_t write(const uint8_t* buf, size_t offset, size_t count) = 0;
49 
50         /**
51          * Close this Output.  It is not valid to call open on a previously closed Output.
52          *
53          * Returns OK on success, or a negative error code.
54          */
55         virtual status_t close();
56 };
57 
58 } /*namespace img_utils*/
59 } /*namespace android*/
60 
61 #endif /*IMG_UTILS_OUTPUT_H*/
62