• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 package com.android.tools.layoutlib.java.util.zip;
17 
18 import java.util.zip.ZipEntry;
19 
20 /**
21  * Wrapper for calls to Android-added API to ZipEntry
22  */
23 public class ZipEntry_Delegate extends ZipEntry {
24 
25     private final long mDataOffset;
26 
27     // Called from  StrictJarFile native code.
ZipEntry_Delegate(String name, String comment, long crc, long compressedSize, long size, int compressionMethod, int xdostime, byte[] extra, long dataOffset)28     public ZipEntry_Delegate(String name, String comment, long crc, long compressedSize, long size,
29             int compressionMethod, int xdostime, byte[] extra, long dataOffset) {
30         super(name);
31         setComment(comment);
32         setCrc(crc);
33         setCompressedSize(compressedSize);
34         setSize(size);
35         setMethod(compressionMethod);
36         setTime(xdostime);
37         setExtra(extra);
38         mDataOffset = dataOffset;
39     }
40 
41     /**
42      * Handle calls to the Android-added ZipEntry#getDataOffset.
43      *
44      * Called from StrictJarFile java code.
45      */
getDataOffset(ZipEntry original)46     public static long getDataOffset(ZipEntry original) {
47         return ((ZipEntry_Delegate) original).mDataOffset;
48     }
49 }
50