org.gjt.sp.jedit.buffer
Class BufferIORequest

java.lang.Object
  extended by org.gjt.sp.util.WorkRequest
      extended by org.gjt.sp.jedit.buffer.BufferIORequest
All Implemented Interfaces:
java.lang.Runnable, ProgressObserver
Direct Known Subclasses:
BufferAutosaveRequest, BufferInsertRequest, BufferLoadRequest, BufferSaveRequest

public abstract class BufferIORequest
extends WorkRequest

A buffer I/O request.


Field Summary
protected  Buffer buffer
           
static java.lang.String END_OFFSETS
           
static java.lang.String ERROR_OCCURRED
          Buffer boolean property set when an error occurs.
static int GZIP_MAGIC_1
          Magic numbers used for auto-detecting Unicode and GZIP files.
static int GZIP_MAGIC_2
           
static int IOBUFSIZE
          Size of I/O buffers.
static java.lang.String LOAD_DATA
           
protected  java.lang.String markersPath
           
static java.lang.String NEW_PATH
           
protected  java.lang.String path
           
static int PROGRESS_INTERVAL
          Number of lines per progress increment.
protected  java.lang.Object session
           
static int UNICODE_MAGIC_1
           
static int UNICODE_MAGIC_2
           
static int UTF8_MAGIC_1
           
static int UTF8_MAGIC_2
           
static int UTF8_MAGIC_3
           
protected  VFS vfs
           
protected  View view
           
static int XML_PI_LENGTH
          Length of longest XML PI used for encoding detection.
 
Constructor Summary
BufferIORequest(View view, Buffer buffer, java.lang.Object session, VFS vfs, java.lang.String path)
          Creates a new buffer I/O request.
 
Method Summary
protected  java.io.Reader autodetect(java.io.InputStream in)
          Tries to detect if the stream is gzipped, and if it has an encoding specified with an XML PI.
protected  SegmentBuffer read(java.io.Reader in, long length, boolean insert)
           
 java.lang.String toString()
           
protected  void write(Buffer buffer, java.io.OutputStream _out)
           
 
Methods inherited from class org.gjt.sp.util.WorkRequest
setAbortable, setMaximum, setProgressMaximum, setProgressValue, setStatus, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

UTF8_MAGIC_1

public static final int UTF8_MAGIC_1
See Also:
Constant Field Values

UTF8_MAGIC_2

public static final int UTF8_MAGIC_2
See Also:
Constant Field Values

UTF8_MAGIC_3

public static final int UTF8_MAGIC_3
See Also:
Constant Field Values

GZIP_MAGIC_1

public static final int GZIP_MAGIC_1
Magic numbers used for auto-detecting Unicode and GZIP files.

See Also:
Constant Field Values

GZIP_MAGIC_2

public static final int GZIP_MAGIC_2
See Also:
Constant Field Values

UNICODE_MAGIC_1

public static final int UNICODE_MAGIC_1
See Also:
Constant Field Values

UNICODE_MAGIC_2

public static final int UNICODE_MAGIC_2
See Also:
Constant Field Values

XML_PI_LENGTH

public static final int XML_PI_LENGTH
Length of longest XML PI used for encoding detection.

<?xml version="1.0" encoding="................"?>

See Also:
Constant Field Values

IOBUFSIZE

public static final int IOBUFSIZE
Size of I/O buffers.

See Also:
Constant Field Values

PROGRESS_INTERVAL

public static final int PROGRESS_INTERVAL
Number of lines per progress increment.

See Also:
Constant Field Values

LOAD_DATA

public static final java.lang.String LOAD_DATA
See Also:
Constant Field Values

END_OFFSETS

public static final java.lang.String END_OFFSETS
See Also:
Constant Field Values

NEW_PATH

public static final java.lang.String NEW_PATH
See Also:
Constant Field Values

ERROR_OCCURRED

public static final java.lang.String ERROR_OCCURRED
Buffer boolean property set when an error occurs.

See Also:
Constant Field Values

view

protected View view

buffer

protected Buffer buffer

session

protected java.lang.Object session

vfs

protected VFS vfs

path

protected java.lang.String path

markersPath

protected java.lang.String markersPath
Constructor Detail

BufferIORequest

public BufferIORequest(View view,
                       Buffer buffer,
                       java.lang.Object session,
                       VFS vfs,
                       java.lang.String path)
Creates a new buffer I/O request.

Parameters:
view - The view
buffer - The buffer
session - The VFS session
vfs - The VFS
path - The path
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

autodetect

protected java.io.Reader autodetect(java.io.InputStream in)
                             throws java.io.IOException
Tries to detect if the stream is gzipped, and if it has an encoding specified with an XML PI.

Throws:
java.io.IOException

read

protected SegmentBuffer read(java.io.Reader in,
                             long length,
                             boolean insert)
                      throws java.io.IOException
Throws:
java.io.IOException

write

protected void write(Buffer buffer,
                     java.io.OutputStream _out)
              throws java.io.IOException
Throws:
java.io.IOException