Package com.gentics.cr

Source Code of com.gentics.cr.AbstractTestHandler

package com.gentics.cr;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

import com.gentics.cr.exceptions.CRException;

public class AbstractTestHandler {
 
  public InputStream getFileAsStream(String path) throws FileNotFoundException {
    return new FileInputStream(AbstractTestHandler.class.getResource("file").getPath() + "/" + path);
  }
 
  public byte[] getFileAsByteArray(String path) throws CRException {
    try {
      return IOUtils.toByteArray(getFileAsStream(path));
    } catch (IOException e) {
      throw new CRException(e);
    }
  }
}
TOP

Related Classes of com.gentics.cr.AbstractTestHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.