*** 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:
-
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_VERSIONFields inherited from class java.rmi.server.RemoteObject
ref -
Constructor Summary
ConstructorsConstructorDescriptionBinaryFileEntry(File file) Creates a binary file entry.BinaryFileEntry(InputStream inputStream, String name) Creates a binary file entry. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRemove any temporary files needed for inputstream re-use and mark this entry as closed.voidConsume and close the input stream provided on the constructor.protected voidfinalize()At finalize time, cleanup temporary files if necessary.InputStreamGets the input stream for this binary file entry.InputStreamgetInputStream(Object streamID) Deprecated.StringReturns the MIME type associated with this binary file entry.StringgetName()Returns the name of the file.com.sas.io.RemoteInputStreamInterfacegetRemoteInputStream(Object streamID) Deprecated.UsegetInputStream()which now supports remote input streams.ObjectDeprecated.this method no longer needed as getInputStream() will return an input stream that can be used in a remote environmentvoidsetMIMEType(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, throwExceptionIfClosedMethods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLogMethods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStubMethods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.sas.entities.EntityKeyInterface
getEntityKey, sameEntity, setEntityKeyMethods 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 anullfile 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 anullinput stream or anullname is specified.RemoteException- If a network anomaly is encountered.
-
-
Method Details
-
getName
Returns the name of the file.- Specified by:
getNamein interfaceBinaryFileEntryInterface- Returns:
StringThe 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
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:
getMIMETypein interfaceBinaryFileEntryInterface- Returns:
StringThe MIME type associated with this binary file entry; can benull. - 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:
setMIMETypein interfaceBinaryFileEntryInterface- 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, IllegalStateExceptionGets the input stream for this binary file entry.- Specified by:
getInputStreamin interfaceBinaryFileEntryInterface- 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.UsegetInputStream()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 utilizegetRemoteInputStream(java.lang.Object)in order to obtain the input stream.- Specified by:
getInputStreamin interfaceBinaryFileEntryInterface- Specified by:
getInputStreamin interfacecom.sas.io.InputStreamProviderInterface- Parameters:
streamID- The stream description should benull; 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.UsegetInputStream()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:
getRemoteInputStreamin interfaceBinaryFileEntryInterface- Specified by:
getRemoteInputStreamin interfacecom.sas.io.InputStreamProviderInterface- Parameters:
streamID- The stream description should benull;it will be ignored.- Returns:
RemoteInputStreamThe 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, IllegalStateExceptionDeprecated.this method no longer needed as getInputStream() will return an input stream that can be used in a remote environmentCheck ifgetInputStream(java.lang.Object)will succeed. SeegetInputStream(java.lang.Object)to determine whether this method should be used.- Specified by:
hasInputStreamin interfaceBinaryFileEntryInterface- Specified by:
hasInputStreamin interfacecom.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 objectIllegalStateException- If the package containing this entry is already closed.RemoteException- if a network I/O error occurs.
-
consumeStream
public void consumeStream() throws IOException, RemoteException, IllegalStateExceptionConsume 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 ThrowableAt finalize time, cleanup temporary files if necessary.- Overrides:
finalizein classObject- Throws:
Throwable
-
getInputStream()which now supports remote input streams.