mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-16 21:19:19 +01:00
Make SHA2 attribute of ContentInfo Optional
This commit is contained in:
parent
7c9fe334a8
commit
f8146ce56b
@ -19,6 +19,7 @@ package de.mas.wiiu.jnus.entities.content;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -37,7 +38,7 @@ public class ContentInfo {
|
|||||||
|
|
||||||
@Getter private final short indexOffset;
|
@Getter private final short indexOffset;
|
||||||
@Getter private final short commandCount;
|
@Getter private final short commandCount;
|
||||||
@Getter private final byte[] SHA2Hash;
|
@Getter private final Optional<byte[]> SHA2Hash;
|
||||||
|
|
||||||
public ContentInfo() {
|
public ContentInfo() {
|
||||||
this((short) 0);
|
this((short) 0);
|
||||||
@ -54,7 +55,11 @@ public class ContentInfo {
|
|||||||
public ContentInfo(short indexOffset, short commandCount, byte[] SHA2Hash) {
|
public ContentInfo(short indexOffset, short commandCount, byte[] SHA2Hash) {
|
||||||
this.indexOffset = indexOffset;
|
this.indexOffset = indexOffset;
|
||||||
this.commandCount = commandCount;
|
this.commandCount = commandCount;
|
||||||
this.SHA2Hash = SHA2Hash;
|
if (SHA2Hash == null) {
|
||||||
|
this.SHA2Hash = Optional.empty();
|
||||||
|
} else {
|
||||||
|
this.SHA2Hash = Optional.of(SHA2Hash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,6 +91,6 @@ public class ContentInfo {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ContentInfo [indexOffset=" + indexOffset + ", commandCount=" + commandCount + ", SHA2Hash=" + Arrays.toString(SHA2Hash) + "]";
|
return "ContentInfo [indexOffset=" + indexOffset + ", commandCount=" + commandCount + ", SHA2Hash=" + SHA2Hash + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user