APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.tools.jlink.internal.runtimelink

public Class ResourceDiff

extends Object
implements Comparable<ResourceDiff>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Imports
java.io.DataInputStream, .DataOutputStream, .IOException, .InputStream, .OutputStream, java.nio.charset.StandardCharsets, java.util.ArrayList, .Collections, .List, .Objects

Class representing a difference of a jimage resource. For all intents and purposes this represents a difference between a resource in an optimized jimage (e.g. images/jdk/lib/modules) and the underlying basic resources from which the optimized image got derived from (e.g. packaged modules). The differences are being used in JRTArchive so as to back-track from an optimized jimage to the original (i.e. it restores original resources using the diff).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static enum

Field Summary

Modifier and TypeField and Description
private final ResourceDiff.Kind
private static final int
private final String
private final byte[]

Constructor Summary

AccessConstructor and Description
private
ResourceDiff(ResourceDiff.Kind kind, String name, byte[] resourceBytes)

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(ResourceDiff o)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public ResourceDiff.Kind
public String
public byte[]
public static void
public static List<ResourceDiff>

Returns:

The list of resource diffs.
read
(InputStream
The input stream to read from
in
)

Read a list of resource diffs from an input stream.

private static byte[]
public static void
write(List<ResourceDiff>
The list of resource diffs to write.
diffs
,
OutputStream
The stream to write the serialized bytes to.
out
)

Writes a list of resource diffs to an output stream

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

kindback to summary
private final ResourceDiff.Kind kind
MAGICback to summary
private static final int MAGIC
nameback to summary
private final String name
resourceBytesback to summary
private final byte[] resourceBytes

Constructor Detail

ResourceDiffback to summary
private ResourceDiff(ResourceDiff.Kind kind, String name, byte[] resourceBytes)

Method Detail

compareToback to summary
public int compareTo(ResourceDiff o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Annotations
@Override
getKindback to summary
public ResourceDiff.Kind getKind()
getNameback to summary
public String getName()
getResourceBytesback to summary
public byte[] getResourceBytes()
printDiffsback to summary
public static void printDiffs(List<ResourceDiff> diffs)
readback to summary
public static List<ResourceDiff> read(InputStream in) throws IOException

Read a list of resource diffs from an input stream.

Parameters
in:InputStream

The input stream to read from

Returns:List<ResourceDiff>

The list of resource diffs.

readBytesFromStreamback to summary
private static byte[] readBytesFromStream(DataInputStream din, int numBytes) throws IOException
writeback to summary
public static void write(List<ResourceDiff> diffs, OutputStream out) throws IOException

Writes a list of resource diffs to an output stream

Parameters
diffs:List<ResourceDiff>

The list of resource diffs to write.

out:OutputStream

The stream to write the serialized bytes to.

jdk.tools.jlink.internal.runtimelink back to summary

public Class ResourceDiff.Builder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private ResourceDiff.Kind
private String
private byte[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ResourceDiff
public ResourceDiff.Builder
public ResourceDiff.Builder
public ResourceDiff.Builder
setResourceBytes(byte[] resourceBytes)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

kindback to summary
private ResourceDiff.Kind kind
nameback to summary
private String name
resourceBytesback to summary
private byte[] resourceBytes

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public ResourceDiff build()
setKindback to summary
public ResourceDiff.Builder setKind(ResourceDiff.Kind kind)
setNameback to summary
public ResourceDiff.Builder setName(String name)
setResourceBytesback to summary
public ResourceDiff.Builder setResourceBytes(byte[] resourceBytes)
jdk.tools.jlink.internal.runtimelink back to summary

public final Enum ResourceDiff.Kind

extends Enum<ResourceDiff.Kind>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ResourceDiff.Kind
public static final ResourceDiff.Kind
public static final ResourceDiff.Kind
private short

Constructor Summary

AccessConstructor and Description
private
Kind(short value)

Method Summary

Modifier and TypeMethod and Description
pack-priv static ResourceDiff.Kind
fromShort(short v)

public short
public static ResourceDiff.Kind
public static ResourceDiff.Kind[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ADDEDback to summary
public static final ResourceDiff.Kind ADDED
MODIFIEDback to summary
public static final ResourceDiff.Kind MODIFIED
REMOVEDback to summary
public static final ResourceDiff.Kind REMOVED
valueback to summary
private short value

Constructor Detail

Kindback to summary
private Kind(short value)

Method Detail

fromShortback to summary
pack-priv static ResourceDiff.Kind fromShort(short v)
valueback to summary
public short value()
valueOfback to summary
public static ResourceDiff.Kind valueOf(String name)
valuesback to summary
public static ResourceDiff.Kind[] values()