public final class TextBufferStreamFactory
extends java.lang.Object
TextBufferStreamFactory is a utilities class for creating InputStream and OutputStream wrappers for a TextBuffer. This is used primarily to support the getInputStream() and getOutputStream of the IDE Document interface implemented by IDE nodes in order to support legacy Addins (such as old JOT.)
Note that the use of getInputStream() and getOutputStream of a node is highly discouraged as it is quite a severe performance hit. Both of these operations in this class are very expensive. It takes at least 3 copy operations of the entire buffer to support getInputStream() (not including reading the data from the Inputstream.) It takes at least 4 copy operations of the entire buffer to support getOutputStream() (not including writing the data to the OutputStream.) This should be sufficient incentive to deprecate these two calls.
| Constructor and Description | 
|---|
TextBufferStreamFactory()  | 
| Modifier and Type | Method and Description | 
|---|---|
static java.io.InputStream | 
getInputStream(TextBuffer textBuffer)
Create an  
InputStream object used for reading the data from a text buffer as an InputStream. | 
static java.io.InputStream | 
getInputStream(TextBuffer textBuffer, java.lang.String encoding)
Create an  
InputStream object used for reading the data from a text buffer as an InputStream. | 
static java.io.OutputStream | 
getOutputStream(TextBuffer textBuffer)
Deprecated. 
 
Use oracle.javatools.buffer.TextBufferFactory.createReader instead. 
 | 
static java.io.OutputStream | 
getOutputStream(TextBuffer textBuffer, java.lang.String encoding)  | 
public static java.io.InputStream getInputStream(TextBuffer textBuffer)
InputStream object used for reading the data from a text buffer as an InputStream. Note that the contents of the buffer are copied out when this call is made, so subsequent changes to the buffer will not be available through the created InputStream.textBuffer - the text buffer to wrappublic static java.io.InputStream getInputStream(TextBuffer textBuffer, java.lang.String encoding)
InputStream object used for reading the data from a text buffer as an InputStream. Note that the contents of the buffer are copied out when this call is made, so subsequent changes to the buffer will not be available through the created InputStream.textBuffer - the text buffer to wrapencoding - the encoding to use when converting chars to bytes; null encoding means to use the platform default encoding.public static java.io.OutputStream getOutputStream(TextBuffer textBuffer)
OutputStream object used for writing the data to an text buffer using an OutputStream interface. Note that the buffer is locked with exclusive access for as long as the OutputStream remains open. You must close the OutputStream in order for the buffer lock to be released.textBuffer - the text buffer to wrappublic static java.io.OutputStream getOutputStream(TextBuffer textBuffer, java.lang.String encoding)