-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c22fb79
commit a606588
Showing
3 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.skyline.warlangmod | ||
|
||
import scala.sys.process._ | ||
import java.net.http._ | ||
import java.net.http.HttpResponse.{BodyHandler, BodyHandlers} | ||
import java.time.Duration | ||
import java.net.{ProxySelector, URI} | ||
import java.io.FileWriter | ||
|
||
|
||
object FetchService { | ||
def fetchFile(): Unit = { | ||
val client = HttpClient | ||
.newBuilder() | ||
.proxy(ProxySelector.getDefault) | ||
.build() | ||
val httpReq = HttpRequest.newBuilder() | ||
.uri(new URI("https://raw.githubusercontent.com/gszabi99/War-Thunder-Datamine/1bc153b0d22ac06719f6ce1ba2c25b567285cc99/lang.vromfs.bin_u/lang/units.csv")) | ||
.timeout(Duration.ofSeconds(20)) | ||
.GET() | ||
.build() | ||
val response = client.send(httpReq,BodyHandlers.ofString()) | ||
val body = response.body() | ||
|
||
val fileWriter = new FileWriter("src/output.csv") | ||
fileWriter.write(body) | ||
fileWriter.close() | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters