All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sksamuel.scrimage.nio.InputStreamImageSource Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
package com.sksamuel.scrimage.nio;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;

public class InputStreamImageSource implements ImageSource {

   private final InputStream stream;

   public InputStreamImageSource(InputStream stream) throws IOException {
      if (stream == null) throw new IOException("Stream is null");
      this.stream = stream;
   }

   @Override
   public byte[] read() throws IOException {
      return IOUtils.toByteArray(stream);
   }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy