Package net.sf.xbus.technical.file

Source Code of net.sf.xbus.technical.file.FileStreamReceiver

package net.sf.xbus.technical.file;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;

import net.sf.xbus.base.core.Constants;
import net.sf.xbus.base.core.XException;
import net.sf.xbus.technical.Receiver;
import net.sf.xbus.technical.ReceiverSingleInterface;

/**
* <code>FileStreamReceiver</code> is a receiver class which opens an
* <code>InputStream</code> of the input file and sends a reference to it
* through the xBus.
*/
public class FileStreamReceiver extends FileReceiver
    implements
      Receiver,
      ReceiverSingleInterface
{
  /*
   * (non-Javadoc)
   *
   * @see net.sf.xbus.technical.file.FileReceiver#getRequestContent()
   */
  protected Object getRequestContent() throws XException
  {
    BufferedInputStream inStream;
    try
    {
      inStream = new BufferedInputStream(new FileInputStream(new File(
          mCopyname)));
    }
    catch (Exception e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_FILE, "0", e);
    }
    return inStream;
  }

  /*
   * (non-Javadoc)
   *
   * @see net.sf.xbus.technical.Receiver#getType()
   */
  public String getType()
  {
    return Constants.TYPE_OBJECT;
  }
}
TOP

Related Classes of net.sf.xbus.technical.file.FileStreamReceiver

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.