blob: 02ee876014f7b3e7852bb20ed8d25464f5aab3b1 [file] [log] [blame]
Adam Lesinskid0f492d2017-04-03 18:12:45 -07001/*
2 * Copyright (C) 2017 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 AAPT_IO_UTIL_H
18#define AAPT_IO_UTIL_H
19
20#include <string>
21
22#include "google/protobuf/message_lite.h"
23
Adam Lesinski46708052017-09-29 14:49:15 -070024#include "format/Archive.h"
Adam Lesinskid0f492d2017-04-03 18:12:45 -070025#include "io/File.h"
26#include "io/Io.h"
27#include "process/IResourceTableConsumer.h"
28
29namespace aapt {
30namespace io {
31
32bool CopyInputStreamToArchive(IAaptContext* context, InputStream* in, const std::string& out_path,
33 uint32_t compression_flags, IArchiveWriter* writer);
34
35bool CopyFileToArchive(IAaptContext* context, IFile* file, const std::string& out_path,
36 uint32_t compression_flags, IArchiveWriter* writer);
37
38bool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::MessageLite* proto_msg,
39 const std::string& out_path, uint32_t compression_flags,
40 IArchiveWriter* writer);
41
42// Copies the data from in to out. Returns false if there was an error.
43// If there was an error, check the individual streams' HadError/GetError methods.
44bool Copy(OutputStream* out, InputStream* in);
45
46} // namespace io
47} // namespace aapt
48
49#endif /* AAPT_IO_UTIL_H */