### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.publish

# Class BinaryFileEntry

java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.sas.services.publish.AbstractEntry
com.sas.services.publish.BinaryFileEntry

All Implemented Interfaces:
  `com.sas.entities.EntityKeyInterface`, `com.sas.io.InputStreamProviderInterface`, `BinaryFileEntryInterface`, `EntryInterface`, `Serializable`, `Remote`

@SASScope("ALL") @BinaryCompatibilityOnly public class BinaryFileEntry extends AbstractEntry implements BinaryFileEntryInterface
Represents a binary file entry that can then be added to a result package for publishing. See Constructing a Result Package to Publish for an example of how this class is used.

Since:
  1.0
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class com.sas.services.publish.AbstractEntry

  `BINARY_COMPAT_VERSION, CATALOG_COMPAT_VERSION, DATASET_COMPAT_VERSION, DEFAULT_ENTRY_VERSION, HTML_COMPAT_VERSION, MDDB_COMPAT_VERSION, NESTEDPACKAGE_COMPAT_VERSION, REFERENCE_COMPAT_VERSION, SQLVIEW_COMPAT_VERSION, TEXT_COMPAT_VERSION, VERSION_94_EXTENDED_ATTRIBUTES, VIEWER_COMPAT_VERSION`

  ### Fields inherited from class java.rmi.server.RemoteObject

  `ref`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BinaryFileEntry(File file)`
  Creates a binary file entry.
  `BinaryFileEntry(InputStream inputStream, String name)`
  Creates a binary file entry.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `closeEntry()`
  Remove any temporary files needed for inputstream re-use and mark this entry as closed.
  `void`
  `consumeStream()`
  Consume and close the input stream provided on the constructor.
  `protected void`
  `finalize()`
  At finalize time, cleanup temporary files if necessary.
  `InputStream`
  `getInputStream()`
  Gets the input stream for this binary file entry.
  `InputStream`
  `getInputStream(Object streamID)`
  Deprecated.
  Use `getInputStream()`which now supports remote input streams.
  `String`
  `getMIMEType()`
  Returns the MIME type associated with this binary file entry.
  `String`
  `getName()`
  Returns the name of the file.
  `com.sas.io.RemoteInputStreamInterface`
  `getRemoteInputStream(Object streamID)`
  Deprecated.
  Use `getInputStream()`which now supports remote input streams.
  `Object`
  `hasInputStream()`
  Deprecated.
  this method no longer needed as getInputStream() will return an input stream that can be used in a remote environment
  `void`
  `setMIMEType(String mimeType)`
  Sets the MIME associated with this file entry.

  ### Methods inherited from class com.sas.services.publish.AbstractEntry

  `getDescription, getEntityKey, getNameValuePairs, getURL, isClosed, isReadOnly, sameEntity, setClosed, setDescription, setEntityKey, setNameValuePairs, setRead, throwExceptionIfClosed`

  ### Methods inherited from class java.rmi.server.UnicastRemoteObject

  `clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject`

  ### Methods inherited from class java.rmi.server.RemoteServer

  `getClientHost, getLog, setLog`

  ### Methods inherited from class java.rmi.server.RemoteObject

  `equals, getRef, hashCode, toString, toStub`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.sas.entities.EntityKeyInterface

  `getEntityKey, sameEntity, setEntityKey`

  ### Methods inherited from interface com.sas.services.publish.EntryInterface

  `getDescription, getNameValuePairs, getURL, isReadOnly, setDescription, setNameValuePairs`

- ## Constructor Details

  - ### BinaryFileEntry

    public BinaryFileEntry(File file) throws IllegalArgumentException, RemoteException
    Creates a binary file entry. When the binary file is published, the file name is used as the name. If a different name is preferred, use the constructor that takes the input stream and the name of the entry.

    There is no default MIME type. To set the MIME type for the entry, use `setMIMEType(java.lang.String)`.

    Parameters:
      `file` - The binary file.
    Throws:
      `IllegalArgumentException` - If a `null` file is specified.
      `RemoteException` - If a network anomaly is encountered.

  - ### BinaryFileEntry

    public BinaryFileEntry(InputStream inputStream, String name) throws IllegalArgumentException, RemoteException
    Creates a binary file entry. When the binary file is published, the input stream will be consumed until end-of-file.

    There is no default MIME type. To set the MIME type for the entry, use `setMIMEType(java.lang.String)`.

    Parameters:
      `inputStream` - The input stream of the binary file.
      `name` - The name of the binary file entry. This name will be used as the name of the entry when publishing the package.
    Throws:
      `IllegalArgumentException` - If a `null` input stream or a `null` name is specified.
      `RemoteException` - If a network anomaly is encountered.

- ## Method Details

  - ### getName

    public String getName() throws RemoteException, TransportException, IllegalStateException
    Returns the name of the file.
    Specified by:
      `getName` in interface `BinaryFileEntryInterface`
    Returns:
      `String` The name of the file.
    Throws:
      `IllegalStateException` - If the package containing this entry is already closed.
      `TransportException` - If the transport encounters an error getting the name.
      `RemoteException` - If a network anomaly is encountered.

  - ### getMIMEType

    public String getMIMEType() throws RemoteException, TransportException, IllegalStateException
    Returns the MIME type associated with this binary file entry. The user-specified MIME type is assigned when the binary file entry is published.
    Specified by:
      `getMIMEType` in interface `BinaryFileEntryInterface`
    Returns:
      `String` The MIME type associated with this binary file entry; can be null.
    Throws:
      `IllegalStateException` - If the package containing this entry is already closed.
      `TransportException` - If the transport encounters an error getting the MIME type.
      `RemoteException` - If a network anomaly is encountered

  - ### setMIMEType

    public void setMIMEType(String mimeType) throws IllegalStateException, RemoteException
    Sets the MIME associated with this file entry.
    Specified by:
      `setMIMEType` in interface `BinaryFileEntryInterface`
    Parameters:
      `mimeType` - The MIME type associated with this file entry.
    Throws:
      `IllegalStateException` - If the entry is read only or if the package containing this entry has already been closed.
      `RemoteException` - If a network anomaly is encountered.

  - ### getInputStream

    public InputStream getInputStream() throws IOException, RemoteException, IllegalStateException
    Gets the input stream for this binary file entry.
    Specified by:
      `getInputStream` in interface `BinaryFileEntryInterface`
    Returns:
      The input stream that can be used for reading the contents of the binary file entry.
    Throws:
      `IllegalStateException` - If the package containing this entry is already closed.
      `IOException` - If an error occurs constructing the input stream.
      `RemoteException` - If a network anomaly is encountered.

  - ### getInputStream

    public InputStream getInputStream(Object streamID) throws IOException, RemoteException, UnmarshalException, IllegalStateException
    Deprecated.
    Use `getInputStream()`which now supports remote input streams.
    Gets the input stream for this binary file entry. Because input streams are not remotable, this method will throw a RemoteException if it is invoked on a remote object. Distributed applications should utilize `getRemoteInputStream(java.lang.Object)`in order to obtain the input stream.
    Specified by:
      `getInputStream` in interface `BinaryFileEntryInterface`
    Specified by:
      `getInputStream` in interface `com.sas.io.InputStreamProviderInterface`
    Parameters:
      `streamID` - The stream description should be `null`; it will be ignored.
    Returns:
      The input stream that can be used for reading the contents of the binary file entry.
    Throws:
      `IllegalStateException` - If the package containing this entry is already closed.
      `UnmarshalException` - If invoked on a remote object.
      `IOException` - If an error occurs constructing the input stream.
      `RemoteException` - If a network anomaly is encountered.

  - ### getRemoteInputStream

    public com.sas.io.RemoteInputStreamInterface getRemoteInputStream(Object streamID) throws com.sas.io.ChainedIOException, RemoteException, IllegalStateException
    Deprecated.
    Use `getInputStream()`which now supports remote input streams.
    Get the binary file as a remote input stream. If your application runs in a distributed environment, it is suggested that you use RemoteInputStream. InputStreams are not remote objects.
    Specified by:
      `getRemoteInputStream` in interface `BinaryFileEntryInterface`
    Specified by:
      `getRemoteInputStream` in interface `com.sas.io.InputStreamProviderInterface`
    Parameters:
      `streamID` - The stream description should be `null` ;it will be ignored.
    Returns:
      `RemoteInputStream` The file as a remote input stream.
    Throws:
      `IllegalStateException` - If the package containing this entry is already closed.
      `com.sas.io.ChainedIOException` - If an I/O error occurs obtaining the input stream.
      `RemoteException` - If a network anomaly is encountered.

  - ### hasInputStream

    public Object hasInputStream() throws UnmarshalException, RemoteException, IllegalStateException
    Deprecated.
    this method no longer needed as getInputStream() will return an input stream that can be used in a remote environment
    Check if `getInputStream(java.lang.Object)`will succeed. See `getInputStream(java.lang.Object)`to determine whether this method should be used.
    Specified by:
      `hasInputStream` in interface `BinaryFileEntryInterface`
    Specified by:
      `hasInputStream` in interface `com.sas.io.InputStreamProviderInterface`
    Returns:
      non-null if getInputStream(java.lang.Object) would succeed; throws UnmarshalException if it would fail
    Throws:
      `UnmarshalException` - if invoked on a remote object
      `IllegalStateException` - If the package containing this entry is already closed.
      `RemoteException` - if a network I/O error occurs.

  - ### consumeStream

    public void consumeStream() throws IOException, RemoteException, IllegalStateException
    Consume and close the input stream provided on the constructor. If an input stream is provided on the entry's constructor, then it does not get consumed until the package is published. This method may be invoked to force the stream to get consumed and closed immediately instead of waiting until the publish occurs.
    Throws:
      `IllegalStateException` - If the package containing this entry is already closed.
      `IOException` - If an error occurs constructing the input stream.
      `RemoteException` - If a network anomaly is encountered.

  - ### closeEntry

    protected void closeEntry()
    Remove any temporary files needed for inputstream re-use and mark this entry as closed.

  - ### finalize

    protected void finalize() throws Throwable
    At finalize time, cleanup temporary files if necessary.
    Overrides:
      `finalize` in class `Object`
    Throws:
      `Throwable`