From c1f6272476ceaf8f0115099c71d782edf87ab310 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 26 Apr 2019 16:42:41 +0200 Subject: [PATCH] Rename functions --- src/de/mas/wiiu/jnus/NUSTitleLoader.java | 2 +- .../implementations/FSTDataProviderNUSTitle.java | 2 +- .../jnus/implementations/NUSDataProviderFST.java | 2 +- .../jnus/implementations/NUSDataProviderLocal.java | 2 +- .../NUSDataProviderLocalBackup.java | 2 +- .../implementations/NUSDataProviderRemote.java | 2 +- .../jnus/implementations/NUSDataProviderWUD.java | 2 +- .../jnus/implementations/NUSDataProviderWoomy.java | 2 +- .../mas/wiiu/jnus/interfaces/NUSDataProvider.java | 14 +++++++------- src/de/mas/wiiu/jnus/utils/DataProviderUtils.java | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/de/mas/wiiu/jnus/NUSTitleLoader.java b/src/de/mas/wiiu/jnus/NUSTitleLoader.java index 30cdb00..4377f2f 100644 --- a/src/de/mas/wiiu/jnus/NUSTitleLoader.java +++ b/src/de/mas/wiiu/jnus/NUSTitleLoader.java @@ -71,7 +71,7 @@ public class NUSTitleLoader { // If we have more than one content, the index 0 is the FST. Content fstContent = result.getTMD().getContentByIndex(0); - InputStream fstContentEncryptedStream = dataProvider.getInputStreamFromContent(fstContent); + InputStream fstContentEncryptedStream = dataProvider.readContentAsStream(fstContent); byte[] fstBytes = StreamUtils.getBytesFromStream(fstContentEncryptedStream, (int) fstContent.getEncryptedFileSize()); diff --git a/src/de/mas/wiiu/jnus/implementations/FSTDataProviderNUSTitle.java b/src/de/mas/wiiu/jnus/implementations/FSTDataProviderNUSTitle.java index 2fa7d57..860932b 100644 --- a/src/de/mas/wiiu/jnus/implementations/FSTDataProviderNUSTitle.java +++ b/src/de/mas/wiiu/jnus/implementations/FSTDataProviderNUSTitle.java @@ -120,7 +120,7 @@ public class FSTDataProviderNUSTitle implements FSTDataProvider, HasNUSTitle { NUSDataProvider dataProvider = title.getDataProvider(); - InputStream in = dataProvider.getInputStreamFromContent(c, streamOffset, streamFilesize); + InputStream in = dataProvider.readContentAsStream(c, streamOffset, streamFilesize); try { NUSDecryption nusdecryption = new NUSDecryption(title.getTicket().get()); diff --git a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderFST.java b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderFST.java index 2367962..31b2c56 100644 --- a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderFST.java +++ b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderFST.java @@ -44,7 +44,7 @@ public class NUSDataProviderFST implements NUSDataProvider { } @Override - public InputStream getInputStreamFromContent(Content content, long offset, long size) throws IOException { + public InputStream readContentAsStream(Content content, long offset, long size) throws IOException { String filename = content.getFilename(); Optional contentFileOpt = FSTUtils.getChildOfDirectory(base, filename); FSTEntry contentFile = contentFileOpt.orElseThrow(() -> new FileNotFoundException(filename + " was not found.")); diff --git a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocal.java b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocal.java index 76ff8ec..1c3ca14 100644 --- a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocal.java +++ b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocal.java @@ -45,7 +45,7 @@ public final class NUSDataProviderLocal implements NUSDataProvider { } @Override - public InputStream getInputStreamFromContent(Content content, long offset, long size) throws IOException { + public InputStream readContentAsStream(Content content, long offset, long size) throws IOException { File filepath = FileUtils.getFileIgnoringFilenameCases(getLocalPath(), content.getFilename()); if (filepath == null || !filepath.exists()) { String errormsg = "Couldn't open \"" + getLocalPath() + File.separator + content.getFilename() + "\", file does not exist"; diff --git a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocalBackup.java b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocalBackup.java index 7c8e105..9b16f84 100644 --- a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocalBackup.java +++ b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderLocalBackup.java @@ -48,7 +48,7 @@ public class NUSDataProviderLocalBackup implements NUSDataProvider { } @Override - public InputStream getInputStreamFromContent(Content content, long offset, long size) throws IOException { + public InputStream readContentAsStream(Content content, long offset, long size) throws IOException { File filepath = new File(getFilePathOnDisk(content)); if (!filepath.exists()) { throw new FileNotFoundException(filepath.getAbsolutePath() + " was not found."); diff --git a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderRemote.java b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderRemote.java index fc9a725..6d55bdb 100644 --- a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderRemote.java +++ b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderRemote.java @@ -37,7 +37,7 @@ public class NUSDataProviderRemote implements NUSDataProvider, Parallelizable { } @Override - public InputStream getInputStreamFromContent(Content content, long fileOffsetBlock, long size) throws IOException { + public InputStream readContentAsStream(Content content, long fileOffsetBlock, long size) throws IOException { NUSDownloadService downloadService = NUSDownloadService.getDefaultInstance(); return downloadService.getInputStreamForURL(getRemoteURL(content), fileOffsetBlock, size); } diff --git a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWUD.java b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWUD.java index 2cf2d8e..a73be6c 100644 --- a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWUD.java +++ b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWUD.java @@ -56,7 +56,7 @@ public class NUSDataProviderWUD implements NUSDataProvider { } @Override - public InputStream getInputStreamFromContent(Content content, long fileOffsetBlock, long size) throws IOException { + public InputStream readContentAsStream(Content content, long fileOffsetBlock, long size) throws IOException { WUDDiscReader discReader = getDiscReader(); long offset = getOffsetInWUD(content) + fileOffsetBlock; diff --git a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWoomy.java b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWoomy.java index 1bf9987..24ec43c 100644 --- a/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWoomy.java +++ b/src/de/mas/wiiu/jnus/implementations/NUSDataProviderWoomy.java @@ -44,7 +44,7 @@ public class NUSDataProviderWoomy implements NUSDataProvider { } @Override - public InputStream getInputStreamFromContent(@NonNull Content content, long fileOffsetBlock, long size) throws IOException { + public InputStream readContentAsStream(@NonNull Content content, long fileOffsetBlock, long size) throws IOException { WoomyZipFile zipFile = getSharedWoomyZipFile(); ZipEntry entry = getWoomyInfo().getContentFiles().get(content.getFilename().toLowerCase()); if (entry == null) { diff --git a/src/de/mas/wiiu/jnus/interfaces/NUSDataProvider.java b/src/de/mas/wiiu/jnus/interfaces/NUSDataProvider.java index 3f2fcc1..2961dcc 100644 --- a/src/de/mas/wiiu/jnus/interfaces/NUSDataProvider.java +++ b/src/de/mas/wiiu/jnus/interfaces/NUSDataProvider.java @@ -27,19 +27,19 @@ import de.mas.wiiu.jnus.utils.StreamUtils; public interface NUSDataProvider { - default public byte[] getChunkFromContent(Content content, long offset, int size) throws IOException { - return StreamUtils.getBytesFromStream(getInputStreamFromContent(content, offset, size), size); + default public byte[] readContent(Content content, long offset, int size) throws IOException { + return StreamUtils.getBytesFromStream(readContentAsStream(content, offset, size), size); } - default public InputStream getInputStreamFromContent(Content content) throws IOException { - return getInputStreamFromContent(content, 0); + default public InputStream readContentAsStream(Content content) throws IOException { + return readContentAsStream(content, 0); } - default public InputStream getInputStreamFromContent(Content content, long offset) throws IOException { - return getInputStreamFromContent(content, offset, content.getEncryptedFileSize() - offset); + default public InputStream readContentAsStream(Content content, long offset) throws IOException { + return readContentAsStream(content, offset, content.getEncryptedFileSize() - offset); } - public InputStream getInputStreamFromContent(Content content, long offset, long size) throws IOException; + public InputStream readContentAsStream(Content content, long offset, long size) throws IOException; public Optional getContentH3Hash(Content content) throws IOException; diff --git a/src/de/mas/wiiu/jnus/utils/DataProviderUtils.java b/src/de/mas/wiiu/jnus/utils/DataProviderUtils.java index b45fe9a..3a457ec 100644 --- a/src/de/mas/wiiu/jnus/utils/DataProviderUtils.java +++ b/src/de/mas/wiiu/jnus/utils/DataProviderUtils.java @@ -133,7 +133,7 @@ public class DataProviderUtils { } Utils.createDir(outputFolder); - InputStream inputStream = dataProvider.getInputStreamFromContent(content); + InputStream inputStream = dataProvider.readContentAsStream(content); if (inputStream == null) { log.warning(content.getFilename() + " Couldn't save encrypted content. Input stream was null"); return;