Java Doc for TclOutputStream.java in  » Scripting » jacl » tcl » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » jacl » tcl.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   tcl.lang.TclOutputStream

TclOutputStream
class TclOutputStream (Code)


Field Summary
protected  booleanbgFlushScheduled
    
protected  booleanblocked
    
protected  booleanblocking
    
protected  intbufSize
    
protected  booleanbufferReady
     Used to track buffer state, these are bit flags stored in the flags filed in the C impl.
protected  intbuffering
    
protected  booleancanSync
     This flag is true when the OutputStream is from a file on disk that should be sync()'ed after a flush.
protected  booleanclosed
    
protected  CharsetEncodercse
     Charset encoder object.
 ChannelBuffercurOut
    
protected  Stringencoding
     Name of Java encoding for this Channel.
 booleanencodingEnd
    
 booleanencodingStart
    
 ObjectencodingState
     Flags used to track encoding states. The encodingState member of called outputEncodingState in the C ChannelState type.
 ChannelBufferoutQueueHead
     First and last buffers in the output queue and the current buffer being filled.
 ChannelBufferoutQueueTail
    
protected  char[]outputStage
     Staging area used to store chars before conversion into buffered bytes.
protected  intrefCount
    
protected  inttranslation
    
protected  intunreportedError
     Posix error code of deferred error.

Constructor Summary
 TclOutputStream(OutputStream inOutput)
     Constructor for Tcl input stream class.

Method Summary
 intcheckFlush(ChannelBuffer buf, boolean newlineFlag)
     CheckFlush -> checkFlush Helper function for writeBytes() and writeChars().
 voidclose()
     Tcl_Close -> close Closes a channel. Closes the channel if this is the last reference. close removes the channel as far as the user is concerned. However, it may continue to exist for a while longer if it has a background flush scheduled.
protected  intcloseChannel(Interp interp, int errorCode)
     CloseChannel -> closeChannel Utility procedure to close a channel and free associated resources. If the channel was stacked, then the it will copy the necessary elements of the NEXT channel into the TOP channel, in essence unstacking the channel.
 intdoWriteChars(char[] src, int srcOff, int srcLen)
     DoWriteChars -> doWriteChars Takes a sequence of characters and converts them for output using the channel's current encoding, may queue the buffer for output if it gets full, and also remembers whether the current buffer is ready e.g.
 voidflush()
     Tcl_Flush -> flush Flushes output data on a channel.
 intflushChannel(Interp interp, boolean calledFromAsyncFlush)
     FlushChannel -> flushChannel This function flushes as much of the queued output as is possible now.
 intgetNumBufferedBytes()
     Tcl_OutputBuffered -> getNumBufferedBytes Return the number of bytes that are current buffered.
 booleanisBlocked()
    
 voidseekCheckBuferReady()
     seekCheckBuferReady This method is used by the seek command to check the channel for buffered output and mark the buffer as ready to flush if found.
 voidsetBlocking(boolean inBlocking)
    
 voidsetBufferSize(int inBufSize)
    
 voidsetBuffering(int inBuffering)
    
 voidsetEncoding(String inEncoding)
    
 voidsetEofChar(char inEofChar)
    
 voidsetSync(boolean canSync)
     Set the sync flag for a channel so that a sync will be invoked in addition to a flush.
 voidsetTranslation(int inTranslation)
    
 booleantranslateEOL(Object dstArray, int dstStart, Object srcArray, int srcStart, IntPtr dstLenPtr, IntPtr srcLenPtr)
     TranslateOutputEOL -> translateEOL Helper function for writeBytes() and writeChars().
 intunicodeToExternal(char[] src, int srcOff, int srcLen, byte[] dst, int dstOff, int dstLen, IntPtr srcReadPtr, IntPtr dstWrotePtr, IntPtr dstCharsPtr)
     Tcl_UtfToExternal -> unicodeToExternal Convert a source buffer from unicode characters to a specified encoding. FIXME: Add doc for return values src, Source characters.
 voidupdateInterest()
     UpdateInterest -> updateInterest Arrange for the notifier to call us back at appropriate times based on the current state of the channel.
 intwriteBytes(byte[] srcArray, int srcOff, int srcLen)
     WriteBytes -> writeBytes Write a sequence of bytes into an output buffer, may queue the buffer for output if it gets full, and also remembers whether the current buffer is ready e.g.
 intwriteChars(char[] srcArray, int srcOff, int srcLen)
     WriteChars -> writeChars Convert chars to the channel's external encoding and write the produced bytes into an output buffer, may queue the buffer for output if it gets full, and also remembers whether the current buffer is ready e.g.
 intwriteObj(TclObject obj)
     Tcl_WriteObj -> writeObj Takes the Tcl object and queues its contents for output.

Field Detail
bgFlushScheduled
protected boolean bgFlushScheduled(Code)



blocked
protected boolean blocked(Code)
Blocked



blocking
protected boolean blocking(Code)
Blocking



bufSize
protected int bufSize(Code)
Buffer size in bytes



bufferReady
protected boolean bufferReady(Code)
Used to track buffer state, these are bit flags stored in the flags filed in the C impl.



buffering
protected int buffering(Code)
Buffering



canSync
protected boolean canSync(Code)
This flag is true when the OutputStream is from a file on disk that should be sync()'ed after a flush. A sync should not be used for non-file streams.



closed
protected boolean closed(Code)



cse
protected CharsetEncoder cse(Code)
Charset encoder object. A null value means that no conversions have been done yet.



curOut
ChannelBuffer curOut(Code)



encoding
protected String encoding(Code)
Name of Java encoding for this Channel. A null value means use no encoding (binary).



encodingEnd
boolean encodingEnd(Code)



encodingStart
boolean encodingStart(Code)



encodingState
Object encodingState(Code)
Flags used to track encoding states. The encodingState member of called outputEncodingState in the C ChannelState type. The encodingStart and encodingEnd members combined are called outputEncodingFlags and have the bit values TCL_ENCODING_END and TCL_ENCODING_START.



outQueueHead
ChannelBuffer outQueueHead(Code)
First and last buffers in the output queue and the current buffer being filled.



outQueueTail
ChannelBuffer outQueueTail(Code)



outputStage
protected char[] outputStage(Code)
Staging area used to store chars before conversion into buffered bytes.



refCount
protected int refCount(Code)
FIXME: add desc



translation
protected int translation(Code)
Translation mode for end-of-line character



unreportedError
protected int unreportedError(Code)
Posix error code of deferred error.




Constructor Detail
TclOutputStream
TclOutputStream(OutputStream inOutput)(Code)
Constructor for Tcl input stream class. We require a byte stream source at init time, the stram can't be changed after the TclInputStream is created.




Method Detail
checkFlush
int checkFlush(ChannelBuffer buf, boolean newlineFlag) throws IOException(Code)
CheckFlush -> checkFlush Helper function for writeBytes() and writeChars(). If the channel buffer is ready to be flushed, flush it. The return value is -1 if there was a problem flushing the channel buffer, or 0 otherwise. The buffer will be recycled if it is flushed.
Parameters:
  buf - Channel buffer to possibly flush.
Parameters:
  newlineFlag - True if a the channel buffercontains a newline.



close
void close() throws IOException(Code)
Tcl_Close -> close Closes a channel. Closes the channel if this is the last reference. close removes the channel as far as the user is concerned. However, it may continue to exist for a while longer if it has a background flush scheduled. The device itself is eventually closed and the channel record removed, in closeChannel.



closeChannel
protected int closeChannel(Interp interp, int errorCode) throws IOException(Code)
CloseChannel -> closeChannel Utility procedure to close a channel and free associated resources. If the channel was stacked, then the it will copy the necessary elements of the NEXT channel into the TOP channel, in essence unstacking the channel. The NEXT channel will then be freed. If the channel was not stacked, then we will free all the bits for the TOP channel, including the data structure itself. Returns 1 if the channel was stacked, 0 otherwise.



doWriteChars
int doWriteChars(char[] src, int srcOff, int srcLen)(Code)
DoWriteChars -> doWriteChars Takes a sequence of characters and converts them for output using the channel's current encoding, may queue the buffer for output if it gets full, and also remembers whether the current buffer is ready e.g. if it contains a newline and we are in line buffering mode. Compensates stacking, i.e. will redirect the data from the specified channel to the topmost channel in a stack. The number of bytes written or -1 in case of error. If -1, Tcl_GetErrno will return the error code. May buffer up output and may cause output to be produced on the channel.
Parameters:
  src - Chars to write.
Parameters:
  srfOff - First index in src array.
Parameters:
  srfLen - Number of chars to write.



flush
void flush() throws IOException(Code)
Tcl_Flush -> flush Flushes output data on a channel.



flushChannel
int flushChannel(Interp interp, boolean calledFromAsyncFlush) throws IOException(Code)
FlushChannel -> flushChannel This function flushes as much of the queued output as is possible now. If calledFromAsyncFlush is true, it is being called in an event handler to flush channel output asynchronously. Return 0 if successful, else the error code that was returned by the channel type operation. May produce output on a channel. May block indefinitely if the channel is synchronous. May schedule an async flush on the channel. May recycle memory for buffers in the output queue.
Parameters:
  interp - Interp object.
Parameters:
  calledFromAsyncFlush - True if called from an asynchronousflush callback.



getNumBufferedBytes
int getNumBufferedBytes()(Code)
Tcl_OutputBuffered -> getNumBufferedBytes Return the number of bytes that are current buffered.



isBlocked
boolean isBlocked()(Code)



seekCheckBuferReady
void seekCheckBuferReady()(Code)
seekCheckBuferReady This method is used by the seek command to check the channel for buffered output and mark the buffer as ready to flush if found.



setBlocking
void setBlocking(boolean inBlocking)(Code)



setBufferSize
void setBufferSize(int inBufSize)(Code)



setBuffering
void setBuffering(int inBuffering)(Code)



setEncoding
void setEncoding(String inEncoding)(Code)



setEofChar
void setEofChar(char inEofChar)(Code)



setSync
void setSync(boolean canSync)(Code)
Set the sync flag for a channel so that a sync will be invoked in addition to a flush.



setTranslation
void setTranslation(int inTranslation)(Code)



translateEOL
boolean translateEOL(Object dstArray, int dstStart, Object srcArray, int srcStart, IntPtr dstLenPtr, IntPtr srcLenPtr)(Code)
TranslateOutputEOL -> translateEOL Helper function for writeBytes() and writeChars(). Converts the '\n' characters in the source buffer into the appropriate EOL form specified by the output translation mode. EOL translation stops either when the source buffer is empty or the output buffer is full. When converting to CRLF mode and there is only 1 byte left in the output buffer, this routine stores the '\r' in the last byte and then stores the '\n' in the byte just past the end of the buffer. The caller is responsible for passing in a buffer that is large enough to hold the extra byte. Results: The return value is 1 if a '\n' was translated from the source buffer, or 0 otherwise -- this can be used by the caller to decide to flush a line-based channel even though the channel buffer is not full. dstLenPtr.i is filled with how many bytes of the output buffer were used. As mentioned above, this can be one more that the output buffer's specified length if a CRLF was stored. srcLenPtr.i is filled with how many bytes of the source buffer were consumed. It may be obvious, but bears mentioning that when converting in CRLF mode (which requires two bytes of storage in the output buffer), the number of bytes consumed from the source buffer will be less than the number of bytes stored in the output buffer. dstArray, Output buffer to fill with translated bytes or chars. dstStart, First unused index in the dst output array. srcArray, Input buffer that holds the bytes or chars to translate srcStart, Index of first available byte in src array. dstLenPtr, On entry, the maximum length of outputbuffer in bytes or chars. On exit, the number ofbytes or chars actually used in output buffer. srcLenPtr, On entry, the length of source buffer.On exit, the number of bytes or chars read fromthe source buffer.



unicodeToExternal
int unicodeToExternal(char[] src, int srcOff, int srcLen, byte[] dst, int dstOff, int dstLen, IntPtr srcReadPtr, IntPtr dstWrotePtr, IntPtr dstCharsPtr)(Code)
Tcl_UtfToExternal -> unicodeToExternal Convert a source buffer from unicode characters to a specified encoding. FIXME: Add doc for return values src, Source characters. srcOff, First index in src input array. srcLen, Number of characters in src buffer. dst, Array to store encoded bytes in. dstOff, First available index in dst array. dstLen, Length of dst array. srcReadPtr, Filled with the number of characters fromthe source string that were converted.This may be less than the original sourcelength if there was a problem convertingsome source characters. dstWrotePtr, Filled with the number of bytes that werestored in the output buffer as a result ofthe conversion dstCharsPtr, Filled with the number of characters thatcorrespond to the bytes stored in theoutput buffer.



updateInterest
void updateInterest()(Code)
UpdateInterest -> updateInterest Arrange for the notifier to call us back at appropriate times based on the current state of the channel.



writeBytes
int writeBytes(byte[] srcArray, int srcOff, int srcLen) throws IOException(Code)
WriteBytes -> writeBytes Write a sequence of bytes into an output buffer, may queue the buffer for output if it gets full, and also remembers whether the current buffer is ready e.g. if it contains a newline and we are in line buffering mode. The number of bytes written or -1 in case of error. If -1, Tcl_GetErrno will return the error code. May buffer up output and may cause output to be produced on the channel.
Parameters:
  src - Bytes to write.
Parameters:
  srfOff - First index in src array.
Parameters:
  srfLen - Number of bytes to write.



writeChars
int writeChars(char[] srcArray, int srcOff, int srcLen) throws IOException(Code)
WriteChars -> writeChars Convert chars to the channel's external encoding and write the produced bytes into an output buffer, may queue the buffer for output if it gets full, and also remembers whether the current buffer is ready e.g. if it contains a newline and we are in line buffering mode. The number of bytes written or -1 in case of error. If -1, Tcl_GetErrno will return the error code. May buffer up output and may cause output to be produced on the channel.
Parameters:
  src - Chars to write.
Parameters:
  srfOff - First index in src array.
Parameters:
  srfLen - Number of chars to write.



writeObj
int writeObj(TclObject obj) throws IOException(Code)
Tcl_WriteObj -> writeObj Takes the Tcl object and queues its contents for output. If the encoding of the channel is NULL, takes the byte-array representation of the object and queues those bytes for output. Otherwise, takes the characters in the UTF-8 (string) representation of the object and converts them for output using the channel's current encoding. May flush internal buffers to output if one becomes full or is ready for some other reason, e.g. if it contains a newline and the channel is in line buffering mode. The number of bytes written or -1 in case of error. If -1, Tcl_GetErrno will return the error code. May buffer up output and may cause output to be produced on the channel.
Parameters:
  obj - The object to write.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.