1d0f492db038c6210c1138865d816bfb134376538Adam Lesinski/* 2d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * Copyright (C) 2017 The Android Open Source Project 3d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * 4d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * Licensed under the Apache License, Version 2.0 (the "License"); 5d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * you may not use this file except in compliance with the License. 6d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * You may obtain a copy of the License at 7d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * 8d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * http://www.apache.org/licenses/LICENSE-2.0 9d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * 10d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * Unless required by applicable law or agreed to in writing, software 11d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * distributed under the License is distributed on an "AS IS" BASIS, 12d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * See the License for the specific language governing permissions and 14d0f492db038c6210c1138865d816bfb134376538Adam Lesinski * limitations under the License. 15d0f492db038c6210c1138865d816bfb134376538Adam Lesinski */ 16d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 17d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#ifndef AAPT_IO_UTIL_H 18d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#define AAPT_IO_UTIL_H 19d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 20d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#include <string> 21d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 22d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#include "google/protobuf/message_lite.h" 23d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 24d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#include "flatten/Archive.h" 25d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#include "io/File.h" 26d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#include "io/Io.h" 27d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#include "process/IResourceTableConsumer.h" 28d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 29d0f492db038c6210c1138865d816bfb134376538Adam Lesinskinamespace aapt { 30d0f492db038c6210c1138865d816bfb134376538Adam Lesinskinamespace io { 31d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 32d0f492db038c6210c1138865d816bfb134376538Adam Lesinskibool CopyInputStreamToArchive(IAaptContext* context, InputStream* in, const std::string& out_path, 33d0f492db038c6210c1138865d816bfb134376538Adam Lesinski uint32_t compression_flags, IArchiveWriter* writer); 34d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 35d0f492db038c6210c1138865d816bfb134376538Adam Lesinskibool CopyFileToArchive(IAaptContext* context, IFile* file, const std::string& out_path, 36d0f492db038c6210c1138865d816bfb134376538Adam Lesinski uint32_t compression_flags, IArchiveWriter* writer); 37d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 38d0f492db038c6210c1138865d816bfb134376538Adam Lesinskibool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::MessageLite* proto_msg, 39d0f492db038c6210c1138865d816bfb134376538Adam Lesinski const std::string& out_path, uint32_t compression_flags, 40d0f492db038c6210c1138865d816bfb134376538Adam Lesinski IArchiveWriter* writer); 41d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 42d0f492db038c6210c1138865d816bfb134376538Adam Lesinski// Copies the data from in to out. Returns false if there was an error. 43d0f492db038c6210c1138865d816bfb134376538Adam Lesinski// If there was an error, check the individual streams' HadError/GetError methods. 44d0f492db038c6210c1138865d816bfb134376538Adam Lesinskibool Copy(OutputStream* out, InputStream* in); 45d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 46d0f492db038c6210c1138865d816bfb134376538Adam Lesinski} // namespace io 47d0f492db038c6210c1138865d816bfb134376538Adam Lesinski} // namespace aapt 48d0f492db038c6210c1138865d816bfb134376538Adam Lesinski 49d0f492db038c6210c1138865d816bfb134376538Adam Lesinski#endif /* AAPT_IO_UTIL_H */ 50