I need help because i need to integrate JOSS in a existing code. My code uses the Consumer feature of Java 8.
Consumer<? super GHRepository> action = repo -> {
try {
if(github.getRateLimit().remaining > 0) {
Files.write(this.path, (repo.toString() + "\n").getBytes(), StandardOpenOption.APPEND);
totalIteration++;
} else {
logger.info("Time to pause for " + (github.getRateLimit().reset.getTime() - new Date().getTime()));
//wait until rate limit is ok.
do {
Thread.sleep(60000);
} while(github.getRateLimit().reset.after(new Date()));
}
} catch (Exception e) {
logger.error("Erreur d'écriture dans le fichier : " + e.getMessage());
}
};
This code works fine but disk space available on the machine is not enough. So i need to write the file directly on an OpenStack container.
I've read in the doc that JOSS uses this function to upload a file.
StoredObject object = container.getObject("dog.png");
object.uploadObject(new File("/dog.png"));
This is the method to upload a file already written. But I need to write the file directly on the container. The uploadObject function can receive a InputStream in parameter. So i want to use it. But i don't know how to integrate it with my existing code. Can you help me?