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

kz.greetgo.msoffice.docx.InputSourceFactory Maven / Gradle / Ivy

There is a newer version: 0.5.9
Show newest version
package kz.greetgo.msoffice.docx;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class InputSourceFactory {
  private InputSourceFactory() {}

  public static InputSource createByFile(final File file) {
    return new InputSource() {
      @Override
      public InputStream openInputStream() throws Exception {
        return new FileInputStream(file);
      }
    };
  }

  public static InputSource createByResource(final Class classs, final String name) {
    return new InputSource() {
      @Override
      public InputStream openInputStream() throws Exception {
        return classs.getResourceAsStream(name);
      }
    };
  }

  public static InputSource createByResource(final String name) {
    return new InputSource() {
      @Override
      public InputStream openInputStream() throws Exception {
        return Object.class.getResourceAsStream(name);
      }
    };
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy