blob: ec1ddb8a07aa569263a20835fcebf553f46cf38d [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
24#include "flatten/Archive.h"
25#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 */