Created
June 19, 2019 22:48
-
-
Save muhang/b00b85dd65bb009bddd5a9a17998cf0b to your computer and use it in GitHub Desktop.
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
import com.bouncex.ingestion.Product; | |
import org.apache.beam.sdk.io.FileSystems; | |
import org.apache.beam.sdk.io.fs.ResourceId; | |
import org.apache.commons.compress.utils.IOUtils; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.net.URL; | |
import java.nio.channels.Channels; | |
class Scratch { | |
public static void main(String[] args) throws IOException { | |
Product product = new Product(); | |
InputStream in = new URL(product.getImageURL()).openStream(); | |
ResourceId rid = FileSystems.matchNewResource(product.getSku(), false); | |
OutputStream out = Channels.newOutputStream(FileSystems.create(rid, "")); | |
IOUtils.copy(in, out); | |
in.close(); | |
out.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment