### *** 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:
  - 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
  Modifier
  Constructor
  Description
  ``
  `TextFileEntry()`
  Creates 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.
  `protected`
  `TextFileEntry(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 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.
  `String`
  `getMIMEType()`
  Returns the MIME type associated with this text file entry.
  `String`
  `getName()`
  Returns the name of the file.
  `Reader`
  `getReader()`
  Gets reader for the text file entry.
  `Reader`
  `getReader(int maxLineLength)`
  Gets reader for the text file entry.
  `Reader`
  `getReader(Object readerID)`
  Deprecated.
  Use `getReader()`which now supports remote readers.
  `com.sas.io.RemoteReaderInterface`
  `getRemoteReader(Object readerID)`
  Deprecated.
  Use `getReader()`which now supports remote readers.
  `Object`
  `hasReader()`
  Deprecated.
  this method no longer needed as getReader() will return a reader that can be used in a remote environment
  `void`
  `setEncoding(String encoding)`
  Sets the encoding of the text file.
  `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

  - ### TextFileEntry

    public TextFileEntry() throws RemoteException
    Creates 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 a `null` file 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 a `null` input stream or a `null` name 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 a `null` reader or a `null` name is specified.
      `RemoteException` - If a network anomaly is encountered.

- ## Method Details

  - ### getMIMEType

    public String getMIMEType() throws RemoteException, TransportException, IllegalStateException
    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:
      `getMIMEType` in interface `TextFileEntryInterface`
    Returns:
      `String` The MIME type associated with this text file entry; can be `null`.
    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:
      `setMIMEType` in interface `TextFileEntryInterface`
    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

    public String getName() throws RemoteException, TransportException, IllegalStateException
    Returns the name of the file.
    Specified by:
      `getName` in interface `TextFileEntryInterface`
    Returns:
      `String` The 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, IllegalStateException
    Gets reader for the text file entry.
    Specified by:
      `getReader` in interface `TextFileEntryInterface`
    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.
    Use `getReader()`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 utilize `getRemoteReader(java.lang.Object)` in order to obtain the reader.
    Specified by:
      `getReader` in interface `com.sas.io.ReaderProviderInterface`
    Specified by:
      `getReader` in interface `TextFileEntryInterface`
    Parameters:
      `readerID` - The reader description should be `null`; 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.
    Use `getReader()`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:
      `getRemoteReader` in interface `com.sas.io.ReaderProviderInterface`
    Specified by:
      `getRemoteReader` in interface `TextFileEntryInterface`
    Parameters:
      `readerID` - The reader description should be `null` ;it will be ignored.
    Returns:
      `RemoteReader` The 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:
      `setEncoding` in interface `TextFileEntryInterface`
    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, IllegalStateException
    Deprecated.
    this method no longer needed as getReader() will return a reader that can be used in a remote environment
    Check if getReader(java.lang.Object) will succeeed.
    Specified by:
      `hasReader` in interface `com.sas.io.ReaderProviderInterface`
    Specified by:
      `hasReader` in interface `TextFileEntryInterface`
    Returns:
      non-null if getReader(java.lang.Object) would succeed; throws UnmarshalException if it would fail
    Throws:
      `UnmarshalException` - if invoked on a remote object
      `RemoteException` - if a network I/O error occurs.
      `IllegalStateException`

  - ### 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.

  - ### 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 truncated

    The maximum line length parameter is only supported by the Requester transport; it will ignored by all other transports.

    Specified by:
      `getReader` in interface `TextFileEntryInterface`
    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 Throwable
    At finalize time, cleanup temporary files if necessary.
    Overrides:
      `finalize` in class `Object`
    Throws:
      `Throwable`