*** This class provides Binary Compatibility only, not Source Compatibility ***
Package com.sas.services.publish
Class TextFileEntry
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.sas.services.publish.AbstractEntry
com.sas.services.publish.TextFileEntry
- All Implemented Interfaces:
com.sas.entities.EntityKeyInterface,com.sas.io.ReaderProviderInterface,EntryInterface,TextFileEntryInterface,Serializable,Remote
@SASScope("ALL")
@BinaryCompatibilityOnly
public class TextFileEntry
extends AbstractEntry
implements TextFileEntryInterface
Represents a text 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
ConstructorsModifierConstructorDescriptionCreates a default instance.TextFileEntry(File file) Creates a text file entry.TextFileEntry(InputStream inputStream, String name) Creates a text file entry.TextFileEntry(Reader reader, String name) Creates a text file entry.protectedTextFileEntry(Class theClass) Creates a new text file entry exporting a remote object using RMI socket factories appropriate for the specified class. -
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.StringReturns the MIME type associated with this text file entry.StringgetName()Returns the name of the file.ReaderGets reader for the text file entry.ReadergetReader(int maxLineLength) Gets reader for the text file entry.ReadergetReader(Object readerID) Deprecated.com.sas.io.RemoteReaderInterfacegetRemoteReader(Object readerID) Deprecated.UsegetReader()which now supports remote readers.ObjectDeprecated.this method no longer needed as getReader() will return a reader that can be used in a remote environmentvoidsetEncoding(String encoding) Sets the encoding of the text file.voidsetMIMEType(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
-
TextFileEntry
public TextFileEntry() throws RemoteExceptionCreates a default instance. This constructor should not be used and is only provided since the compiler was previously providing a default public constructor. Use {#TextFileEntry(File file)} instead.- Throws:
RemoteException- If a network anomaly is encountered.
-
TextFileEntry
protected TextFileEntry(Class theClass) throws RemoteException Creates a new text file entry exporting a remote object using RMI socket factories appropriate for the specified class.- Parameters:
theClass- The class to use when determine which RMI socket factories are to be used when exporting a remote object.- Throws:
RemoteException- If a network anomaly is encountered.
-
TextFileEntry
public TextFileEntry(File file) throws IllegalArgumentException, RemoteException Creates a text file entry. When the text 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.- Parameters:
file- The text file.- Throws:
IllegalArgumentException- If anullfile is specified.RemoteException- If a network anomaly is encountered.
-
TextFileEntry
public TextFileEntry(InputStream inputStream, String name) throws IllegalArgumentException, RemoteException Creates a text file entry. When the text file is published, the input stream will be consumed until end-of-file.- Parameters:
inputStream- The input stream of the text file.name- The name of the text 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.
-
TextFileEntry
public TextFileEntry(Reader reader, String name) throws IllegalArgumentException, RemoteException Creates a text file entry. When the text file is published, the reader will be consumed until end-of-file.- Parameters:
reader- The reader.name- The name of the text file entry. This name will be used as the name of the entry when publishing the package.- Throws:
IllegalArgumentException- If anullreader or anullname is specified.RemoteException- If a network anomaly is encountered.
-
-
Method Details
-
getMIMEType
Returns the MIME type associated with this text file entry. The user-specified MIME type is assigned when the text file entry is published.- Specified by:
getMIMETypein interfaceTextFileEntryInterface- Returns:
StringThe MIME type associated with this text file entry; can benull.- Throws:
IllegalStateException- if the result package containing this entry has already been 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 interfaceTextFileEntryInterface- Parameters:
mimeType- The MIME type associated with this file entry.- Throws:
IllegalStateException- If the entry is read only or if the result package containing this entry has alredy been closed.RemoteException- If a network anomaly is encountered.
-
getName
Returns the name of the file.- Specified by:
getNamein interfaceTextFileEntryInterface- Returns:
StringThe name of the file.- Throws:
IllegalStateException- if the result package containing this entry has already been closed.TransportException- If the transport encounters an error getting the name of the file.RemoteException- If a network anomaly is encountered.
-
getReader
public Reader getReader() throws IOException, RemoteException, IllegalStateExceptionGets reader for the text file entry.- Specified by:
getReaderin interfaceTextFileEntryInterface- Returns:
- The reader that can be used for reading the contents of the text file entry.
- Throws:
IllegalStateException- if the result package containing this entry has already been closed.IOException- If an error occurs constructing the input stream.RemoteException- If a network anomaly is encountered.
-
getReader
public Reader getReader(Object readerID) throws IOException, RemoteException, UnmarshalException, IllegalStateException Deprecated.UsegetReader()which now supports remote readers.Gets reader for the text file entry. Because readers are not remotable, this method will throw a RemoteException if it is invoked on a remote object. Distributed applications should utilizegetRemoteReader(java.lang.Object)in order to obtain the reader.- Specified by:
getReaderin interfacecom.sas.io.ReaderProviderInterface- Specified by:
getReaderin interfaceTextFileEntryInterface- Parameters:
readerID- The reader description should benull; it will be ignored.- Returns:
- The reader that can be used for reading the contents of the text file entry.
- Throws:
IllegalStateException- if the result package containing this entry has already been closed.UnmarshalException- If invoked on a remote object.IOException- If an error occurs constructing the input stream.RemoteException- If a network anomaly is encountered.
-
getRemoteReader
public com.sas.io.RemoteReaderInterface getRemoteReader(Object readerID) throws com.sas.io.ChainedIOException, RemoteException, IllegalStateException Deprecated.UsegetReader()which now supports remote readers.Get the a remote reader. Because the Reader class is not a remotable, distributed applications should use a RemoteReader.- Specified by:
getRemoteReaderin interfacecom.sas.io.ReaderProviderInterface- Specified by:
getRemoteReaderin interfaceTextFileEntryInterface- Parameters:
readerID- The reader description should benull;it will be ignored.- Returns:
RemoteReaderThe file as a remote Reader.- Throws:
IllegalStateException- if the result package containing this entry has already been closed.com.sas.io.ChainedIOException- If an I/O error occurs obtaining the reader.RemoteException- If a network anomaly is encountered.
-
setEncoding
public void setEncoding(String encoding) throws RemoteException, IllegalStateException Sets the encoding of the text file. This method can only be specified when constructing a package to be published. If specified, the encoding is used when constructing the Reader that is returned by getReader and and getRemoteReader, and it is used to publish the file.- Specified by:
setEncodingin interfaceTextFileEntryInterface- Parameters:
encoding- The encoding for this text file.- Throws:
IllegalStateException- If the entry is read only or if the result package containing this entry has already been closed.RemoteException- If a network anomaly is encountered
-
hasReader
public Object hasReader() throws UnmarshalException, RemoteException, IllegalStateExceptionDeprecated.this method no longer needed as getReader() will return a reader that can be used in a remote environmentCheck if getReader(java.lang.Object) will succeeed.- Specified by:
hasReaderin interfacecom.sas.io.ReaderProviderInterface- Specified by:
hasReaderin interfaceTextFileEntryInterface- Returns:
- non-null if getReader(java.lang.Object) would succeed; throws UnmarshalException if it would fail
- Throws:
UnmarshalException- if invoked on a remote objectRemoteException- if a network I/O error occurs.IllegalStateException
-
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. -
getReader
public Reader getReader(int maxLineLength) throws IOException, RemoteException, IllegalStateException Gets reader for the text file entry. The maximum line length is by the Requester transport when reading the text file; it identifies the maximum length of any line that will be in the file. This is typically set to some larger value than is actually used. If a huge number is specified, some hosts will adjust this down to a more reasonable value. Lines longer than this specified maxLineLength will be truncatedThe maximum line length parameter is only supported by the Requester transport; it will ignored by all other transports.
- Specified by:
getReaderin interfaceTextFileEntryInterface- Parameters:
maxLineLength- the maximum length of any line that will be in the file. This parameter is supported by the Requester transport; it will be ignored by all other delivery transports.- Returns:
- The reader that can be used for reading the contents of the text file entry.
- Throws:
IOException- If an error occurs constructing the input stream.RemoteException- If a network anomaly is encountered.IllegalStateException- If the package containing this entry is already closed.
-
finalize
protected void finalize() throws ThrowableAt finalize time, cleanup temporary files if necessary.- Overrides:
finalizein classObject- Throws:
Throwable
-
getReader()which now supports remote readers.