OLD | NEW |
1 // Copyright 2015 Google Inc. All rights reserved. | 1 // Copyright 2015 The Bazel Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // to a memory buffer to write the data of the file into. This buffer | 56 // to a memory buffer to write the data of the file into. This buffer |
57 // is owned by ZipBuilder and should not be free'd by the caller. The | 57 // is owned by ZipBuilder and should not be free'd by the caller. The |
58 // file length is then specified when the files is finished written | 58 // file length is then specified when the files is finished written |
59 // using the FinishFile(size_t) function. | 59 // using the FinishFile(size_t) function. |
60 // On failure, returns NULL and GetError() will return an non-empty message. | 60 // On failure, returns NULL and GetError() will return an non-empty message. |
61 virtual u1* NewFile(const char* filename, const u4 attr) = 0; | 61 virtual u1* NewFile(const char* filename, const u4 attr) = 0; |
62 | 62 |
63 // Finish writing a file and specify its length. After calling this method | 63 // Finish writing a file and specify its length. After calling this method |
64 // one should not reuse the pointer given by NewFile. The file can be | 64 // one should not reuse the pointer given by NewFile. The file can be |
65 // compressed using the deflate algorithm by setting `compress` to true. | 65 // compressed using the deflate algorithm by setting `compress` to true. |
| 66 // By default, CRC32 are not computed as java tooling doesn't care, but |
| 67 // computing it can be activated by setting `compute_crc` to true. |
66 // On failure, returns -1 and GetError() will return an non-empty message. | 68 // On failure, returns -1 and GetError() will return an non-empty message. |
67 virtual int FinishFile(size_t filelength, bool compress = false) = 0; | 69 virtual int FinishFile(size_t filelength, |
| 70 bool compress = false, |
| 71 bool compute_crc = false) = 0; |
68 | 72 |
69 // Write an empty file, it is equivalent to: | 73 // Write an empty file, it is equivalent to: |
70 // NewFile(filename, 0); | 74 // NewFile(filename, 0); |
71 // FinishFile(0); | 75 // FinishFile(0); |
72 // On failure, returns -1 and GetError() will return an non-empty message. | 76 // On failure, returns -1 and GetError() will return an non-empty message. |
73 virtual int WriteEmptyFile(const char* filename) = 0; | 77 virtual int WriteEmptyFile(const char* filename) = 0; |
74 | 78 |
75 // Finish writing the ZIP file. This method can be called only once | 79 // Finish writing the ZIP file. This method can be called only once |
76 // (subsequent calls will do nothing) and none of | 80 // (subsequent calls will do nothing) and none of |
77 // NewFile/FinishFile/WriteEmptyFile should be called after calling Finish. If | 81 // NewFile/FinishFile/WriteEmptyFile should be called after calling Finish. If |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // it with "processor". | 164 // it with "processor". |
161 // On error, a null pointer is returned and the value of errno should be | 165 // On error, a null pointer is returned and the value of errno should be |
162 // checked. | 166 // checked. |
163 static ZipExtractor* Create(const char* filename, | 167 static ZipExtractor* Create(const char* filename, |
164 ZipExtractorProcessor *processor); | 168 ZipExtractorProcessor *processor); |
165 }; | 169 }; |
166 | 170 |
167 } // namespace devtools_ijar | 171 } // namespace devtools_ijar |
168 | 172 |
169 #endif // INCLUDED_THIRD_PARTY_IJAR_ZIP_H | 173 #endif // INCLUDED_THIRD_PARTY_IJAR_ZIP_H |
OLD | NEW |