mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-05 07:45:11 +01:00
Rename functions
This commit is contained in:
parent
a48f2c7547
commit
c1f6272476
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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<FSTEntry> contentFileOpt = FSTUtils.getChildOfDirectory(base, filename);
|
||||
FSTEntry contentFile = contentFileOpt.orElseThrow(() -> new FileNotFoundException(filename + " was not found."));
|
||||
|
@ -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";
|
||||
|
@ -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.");
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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<byte[]> getContentH3Hash(Content content) throws IOException;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user