src/java.base/share/classes/jdk/internal/jimage/decompressor/ResourceDecompressor.java
author erikj
Wed, 07 Mar 2018 13:26:15 -0800
changeset 49357 aaedb8343784
parent 47216 71c04702a3d5
permissions -rw-r--r--
8198243: Add build time check for global operator new/delete in object files Reviewed-by: tbell, kbarrett, dholmes, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31673
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     1
/*
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
31673
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     4
 *
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    10
 *
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    15
 * accompanied this code).
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    16
 *
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    20
 *
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    23
 * questions.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    24
 */
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    25
package jdk.internal.jimage.decompressor;
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    26
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    27
/**
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    28
 *
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    29
 * JLink Image Decompressor.
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    30
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    31
 * @implNote This class needs to maintain JDK 8 source compatibility.
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    32
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    33
 * It is used internally in the JDK to implement jimage/jrtfs access,
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    34
 * but also compiled and delivered as part of the jrtfs.jar to support access
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    35
 * to the jimage file provided by the shipped JDK by tools running on JDK 8.
31673
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    36
 */
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    37
public interface ResourceDecompressor {
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    38
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    39
    public interface StringsProvider {
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    40
        public String getString(int offset);
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    41
    }
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    42
    /**
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    43
     * Decompressor unique name.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    44
     * @return The decompressor name.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    45
     */
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    46
    public String getName();
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    47
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    48
    /**
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    49
     * Decompress a resource.
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    50
     * @param strings The String provider
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    51
     * @param content The resource content
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    52
     * @param offset Resource content offset
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    53
     * @param originalSize Uncompressed size
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    54
     * @return Uncompressed resource
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    55
     * @throws Exception
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    56
     */
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    57
    public byte[] decompress(StringsProvider strings, byte[] content, int offset,
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 31673
diff changeset
    58
            long originalSize) throws Exception;
31673
135283550686 8080511: Refresh of jimage support
jfdenise
parents:
diff changeset
    59
}