tcl.lang.channel
Class FileChannel

java.lang.Object
  extended by tcl.lang.channel.Channel
      extended by tcl.lang.channel.SeekableChannel
          extended by tcl.lang.channel.FileChannel

public class FileChannel
extends SeekableChannel

Subclass of the abstract class SeekableChannel. It implements all of the methods to perform read, write, open, close, etc on a file.


Field Summary
 
Fields inherited from class tcl.lang.channel.Channel
blocking, buffering, bufferSize, encoding, eofInputFilter, eofOutputFilter, eolInputFilter, eolOutputFilter, finalInputStream, finalReader, firstOutputStream, firstWriter, inputBuffer, inputEofChar, inputTranslation, markableInputStream, mode, nonBlockingOutputStream, outputBuffer, outputEofChar, outputTranslation, rawInputStream, rawOutputStream, READ_OWNERSHIP, refCount, unicodeDecoder, unicodeEncoder, WRITE_OWNERSHIP
 
Constructor Summary
FileChannel()
           
 
Method Summary
protected  InputStream getInputStream()
          This method should be overridden in the subclass to provide a channel specific InputStream object.
protected  OutputStream getOutputStream()
          This method should be overridden in the subclass to provide a channel specific OutputStream object.
 String open(Interp interp, String fileName, int modeFlags)
          Open a file with the read/write permissions determined by modeFlags.
 
Methods inherited from class tcl.lang.channel.SeekableChannel
seek, tell
 
Methods inherited from class tcl.lang.channel.Channel
checkRead, checkWrite, close, eof, flush, getBlocking, getBuffering, getBufferSize, getChanName, getEncoding, getInputEofChar, getInputTranslation, getOutputEofChar, getOutputTranslation, initInput, initOutput, isBlocked, isClosed, isReadOnly, isReadWrite, isWriteOnly, read, setBlocking, setBuffering, setBufferSize, setEncoding, setInputEofChar, setInputTranslation, setOutputEofChar, setOutputTranslation, setOwnership, setOwnership, waitForOwnership, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileChannel

public FileChannel()
Method Detail

open

public String open(Interp interp,
                   String fileName,
                   int modeFlags)
            throws IOException,
                   TclException
Open a file with the read/write permissions determined by modeFlags. This method must be called before any other methods will function properly.

Parameters:
interp - currrent interpreter.
fileName - the absolute path or name of file in the current directory to open
modeFlags - modes used to open a file for reading, writing, etc
Returns:
the channelId of the file.
Throws:
TclException - is thrown when the modeFlags try to open a file it does not have permission for or if the file dosent exist and CREAT wasnt specified.
IOException - is thrown when an IO error occurs that was not correctly tested for. Most cases should be caught.

getInputStream

protected InputStream getInputStream()
                              throws IOException
Description copied from class: Channel
This method should be overridden in the subclass to provide a channel specific InputStream object.

Specified by:
getInputStream in class Channel
Throws:
IOException

getOutputStream

protected OutputStream getOutputStream()
                                throws IOException
Description copied from class: Channel
This method should be overridden in the subclass to provide a channel specific OutputStream object.

Specified by:
getOutputStream in class Channel
Throws:
IOException


Copyright © 2015. All rights reserved.