Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
URL download: success
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyxlandlee committed Dec 29, 2020
1 parent d08cae7 commit 360c050
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/io/github/teddyxlandlee/nios/filesplit/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import io.github.teddyxlandlee.nios.filesplit.util.*;

import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;

import static io.github.teddyxlandlee.nios.filesplit.util.ByteHelperKt.*;
import static io.github.teddyxlandlee.nios.filesplit.util.ByteHelperKt.fromInt;
import static io.github.teddyxlandlee.nios.filesplit.util.ByteHelperKt.toInt;

public class Core {
public static void run(CodecStatus codecStatus, File file, int maxOneFileSize, String outputDirectory) {
Expand Down Expand Up @@ -126,7 +126,13 @@ public static void decodeGit(URL url) throws IOException {
urlInfo = new URL(url.toString() + '/' + filenameCount + ".fsplit");
inputStream = NetworkHelperKt.httpInputStream(urlInfo);
iCache2 = inputStream.read(cache, 0, 4);
if (iCache2 ! = 4)
if (iCache2 != 4 || toInt(cache) != VersionKt.fsplitHeader)
throw new InvalidFileException(iCache2 + ".fsplit", 0x00000002);
cache = inputStream.readAllBytes();
outputStream.write(cache);
inputStream.close();
}
outputStream.close();
System.out.println("Successfully decode file at " + newFile.getAbsolutePath());
}
}

0 comments on commit 360c050

Please sign in to comment.