Formatting and organizing imports

This commit is contained in:
Maschell 2019-04-26 16:44:57 +02:00
parent c1f6272476
commit 3eb299d3a1
12 changed files with 11 additions and 17 deletions

View File

@ -25,7 +25,6 @@ import java.util.stream.Stream;
import de.mas.wiiu.jnus.entities.TMD; import de.mas.wiiu.jnus.entities.TMD;
import de.mas.wiiu.jnus.entities.Ticket; import de.mas.wiiu.jnus.entities.Ticket;
import de.mas.wiiu.jnus.entities.content.Content;
import de.mas.wiiu.jnus.entities.fst.FST; import de.mas.wiiu.jnus.entities.fst.FST;
import de.mas.wiiu.jnus.entities.fst.FSTEntry; import de.mas.wiiu.jnus.entities.fst.FSTEntry;
import de.mas.wiiu.jnus.interfaces.NUSDataProvider; import de.mas.wiiu.jnus.interfaces.NUSDataProvider;

View File

@ -23,5 +23,5 @@ import lombok.Data;
public class NUSTitleConfig { public class NUSTitleConfig {
private Ticket ticket; private Ticket ticket;
private boolean noDecryption; private boolean noDecryption;
private byte[] commonKey; private byte[] commonKey;
} }

View File

@ -25,6 +25,7 @@ public final class NUSTitleLoaderLocalBackup {
private NUSTitleLoaderLocalBackup() { private NUSTitleLoaderLocalBackup() {
} }
public static NUSTitle loadNUSTitle(String inputPath, short titleVersion, Ticket ticket) throws Exception { public static NUSTitle loadNUSTitle(String inputPath, short titleVersion, Ticket ticket) throws Exception {
NUSTitleConfig config = new NUSTitleConfig(); NUSTitleConfig config = new NUSTitleConfig();

View File

@ -104,7 +104,7 @@ public final class TMD {
public static TMD parseTMD(File tmd) throws IOException, ParseException { public static TMD parseTMD(File tmd) throws IOException, ParseException {
if (tmd == null || !tmd.exists()) { if (tmd == null || !tmd.exists()) {
log.info("TMD input file null or doesn't exist."); log.info("TMD input file null or doesn't exist.");
throw new IOException("TMD input file null or doesn't exist."); throw new IOException("TMD input file null or doesn't exist.");
} }
return parseTMD(Files.readAllBytes(tmd.toPath())); return parseTMD(Files.readAllBytes(tmd.toPath()));
} }
@ -145,7 +145,7 @@ public final class TMD {
buffer.position(0x184); buffer.position(0x184);
long systemVersion = buffer.getLong(); long systemVersion = buffer.getLong();
long titleID = buffer.getLong(); long titleID = buffer.getLong();
if((titleID & 0x0005000000000000L) != 0x0005000000000000L) { if ((titleID & 0x0005000000000000L) != 0x0005000000000000L) {
throw new ParseException("Invalid TMD file. This is not a Wii U TMD", 0); throw new ParseException("Invalid TMD file. This is not a Wii U TMD", 0);
} }
int titleType = buffer.getInt(); int titleType = buffer.getInt();

View File

@ -18,16 +18,12 @@ 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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import de.mas.wiiu.jnus.Settings; import de.mas.wiiu.jnus.Settings;
import de.mas.wiiu.jnus.entities.fst.FSTEntry;
import de.mas.wiiu.jnus.utils.Utils; import de.mas.wiiu.jnus.utils.Utils;
import lombok.Data; import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import lombok.extern.java.Log; import lombok.extern.java.Log;
/** /**

View File

@ -55,7 +55,7 @@ public final class ContentFSTInfo {
* @param input * @param input
* 0x20 byte of data from the FST (starting at 0x20) * 0x20 byte of data from the FST (starting at 0x20)
* @return ContentFSTInfo object * @return ContentFSTInfo object
* @throws ParseException * @throws ParseException
*/ */
public static ContentFSTInfo parseContentFST(byte[] input) throws ParseException { public static ContentFSTInfo parseContentFST(byte[] input) throws ParseException {
if (input == null || input.length != 0x20) { if (input == null || input.length != 0x20) {

View File

@ -56,8 +56,8 @@ public class NUSDataProviderFST implements NUSDataProvider {
@Override @Override
public Optional<byte[]> getContentH3Hash(Content content) throws IOException { public Optional<byte[]> getContentH3Hash(Content content) throws IOException {
Optional<byte[]> res = h3Hashes.get(content.getID()); Optional<byte[]> res = h3Hashes.get(content.getID());
if(res == null) { if (res == null) {
res =readFileByFilename(base, String.format("%08X%s", content.getID(), Settings.H3_EXTENTION)); res = readFileByFilename(base, String.format("%08X%s", content.getID(), Settings.H3_EXTENTION));
h3Hashes.put(content.getID(), res); h3Hashes.put(content.getID(), res);
} }
return res; return res;

View File

@ -26,7 +26,6 @@ import de.mas.wiiu.jnus.entities.fst.FST;
import de.mas.wiiu.jnus.utils.StreamUtils; import de.mas.wiiu.jnus.utils.StreamUtils;
public interface NUSDataProvider { public interface NUSDataProvider {
default public byte[] readContent(Content content, long offset, int size) throws IOException { default public byte[] readContent(Content content, long offset, int size) throws IOException {
return StreamUtils.getBytesFromStream(readContentAsStream(content, offset, size), size); return StreamUtils.getBytesFromStream(readContentAsStream(content, offset, size), size);
} }

View File

@ -23,7 +23,7 @@ import lombok.NonNull;
public final class ByteArrayWrapper { public final class ByteArrayWrapper {
private final byte[] data; private final byte[] data;
public ByteArrayWrapper(@NonNull byte[] data) { public ByteArrayWrapper(@NonNull byte[] data) {
this.data = data; this.data = data;
} }

View File

@ -34,8 +34,8 @@ public final class StreamUtils {
} }
/** /**
* Tries to read a given amount of bytes from a stream and return them as * Tries to read a given amount of bytes from a stream and return them as a byte array. Closes the inputs stream on success AND failure.
* a byte array. Closes the inputs stream on success AND failure. *
* @param in * @param in
* @param size * @param size
* @return * @return

View File

@ -179,7 +179,7 @@ public final class Utils {
return 0L; return 0L;
} }
} }
public static void setGlobalLogLevel(Level level) { public static void setGlobalLogLevel(Level level) {
Arrays.stream(LogManager.getLogManager().getLogger("").getHandlers()).forEach(h -> h.setLevel(level)); Arrays.stream(LogManager.getLogManager().getLogger("").getHandlers()).forEach(h -> h.setLevel(level));
} }

View File

@ -23,7 +23,6 @@ import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import de.mas.wiiu.jnus.Settings; import de.mas.wiiu.jnus.Settings;