Extension SDK 10.1.2

oracle.ide.util
Class TextBufferStreamFactory

java.lang.Object
  extended byoracle.ide.util.TextBufferStreamFactory

public final class TextBufferStreamFactory
extends java.lang.Object

The 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 Summary
TextBufferStreamFactory()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextBufferStreamFactory

public TextBufferStreamFactory()
Method Detail

getInputStream

public static java.io.InputStream getInputStream(TextBuffer textBuffer)
Create an 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.

Parameters:
textBuffer - the text buffer to wrap
Returns:
an InputStream wrapping the given text buffer

getInputStream

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

Parameters:
textBuffer - the text buffer to wrap
encoding - the encoding to use when converting chars to bytes; null encoding means to use the platform default encoding.
Returns:
an InputStream wrapping the given text buffer

getOutputStream

public static java.io.OutputStream getOutputStream(TextBuffer textBuffer)
Deprecated. Use oracle.javatools.buffer.TextBufferFactory.createReader instead.

Create an 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.

Parameters:
textBuffer - the text buffer to wrap
Returns:
an OutputStream wrapping the given text buffer

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.