org.kohsuke.stapler.framework.io
Class LargeText

java.lang.Object
  extended by org.kohsuke.stapler.framework.io.LargeText

public class LargeText
extends java.lang.Object

Represents a large text data.

This class defines methods for handling progressive text update.

Usage

Author:
Kohsuke Kawaguchi

Field Summary
protected  java.nio.charset.Charset charset
           
 
Constructor Summary
LargeText(ByteBuffer memory, boolean completed)
           
LargeText(ByteBuffer memory, java.nio.charset.Charset charset, boolean completed)
           
LargeText(java.io.File file, boolean completed)
           
LargeText(java.io.File file, java.nio.charset.Charset charset, boolean completed)
           
 
Method Summary
protected  java.io.Writer createWriter(StaplerRequest req, StaplerResponse rsp, long size)
           
 void doProgressText(StaplerRequest req, StaplerResponse rsp)
          Implements the progressive text handling.
 boolean isComplete()
           
 long length()
           
 void markAsComplete()
           
 java.io.Reader readAll()
          Returns Reader for reading the raw bytes.
protected  void setContentType(StaplerResponse rsp)
           
 long writeLogTo(long start, java.io.OutputStream out)
          Writes the tail portion of the file to the OutputStream.
 long writeLogTo(long start, java.io.Writer w)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charset

protected final java.nio.charset.Charset charset
Constructor Detail

LargeText

public LargeText(java.io.File file,
                 boolean completed)

LargeText

public LargeText(java.io.File file,
                 java.nio.charset.Charset charset,
                 boolean completed)

LargeText

public LargeText(ByteBuffer memory,
                 boolean completed)

LargeText

public LargeText(ByteBuffer memory,
                 java.nio.charset.Charset charset,
                 boolean completed)
Method Detail

markAsComplete

public void markAsComplete()

isComplete

public boolean isComplete()

length

public long length()

readAll

public java.io.Reader readAll()
                       throws java.io.IOException
Returns Reader for reading the raw bytes.

Throws:
java.io.IOException

writeLogTo

public long writeLogTo(long start,
                       java.io.Writer w)
                throws java.io.IOException
Throws:
java.io.IOException

writeLogTo

public long writeLogTo(long start,
                       java.io.OutputStream out)
                throws java.io.IOException
Writes the tail portion of the file to the OutputStream.

Parameters:
start - The byte offset in the input file where the write operation starts.
Returns:
if the file is still being written, this method writes the file until the last newline character and returns the offset to start the next write operation.
Throws:
java.io.IOException

doProgressText

public void doProgressText(StaplerRequest req,
                           StaplerResponse rsp)
                    throws java.io.IOException
Implements the progressive text handling. This method is used as a "web method" with progressiveText.jelly.

Throws:
java.io.IOException

setContentType

protected void setContentType(StaplerResponse rsp)

createWriter

protected java.io.Writer createWriter(StaplerRequest req,
                                      StaplerResponse rsp,
                                      long size)
                               throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.