Package org.kohsuke.stapler.framework.io
Class LargeText
- java.lang.Object
-
- org.kohsuke.stapler.framework.io.LargeText
-
public class LargeText extends Object
Represents a large text data.This class defines methods for handling progressive text update.
Usage
- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description LargeText(File file, boolean completed)
LargeText(File file, boolean completed, boolean transparentGunzip)
LargeText(File file, Charset charset, boolean completed)
LargeText(File file, Charset charset, boolean completed, boolean transparentGunzip)
LargeText(ByteBuffer memory, boolean completed)
LargeText(ByteBuffer memory, Charset charset, boolean completed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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()
Reader
readAll()
ReturnsReader
for reading the raw bytes.protected void
setContentType(StaplerResponse rsp)
long
writeLogTo(long start, OutputStream out)
Writes the tail portion of the file to theOutputStream
.long
writeLogTo(long start, Writer w)
-
-
-
Field Detail
-
charset
protected final Charset charset
-
-
Constructor Detail
-
LargeText
public LargeText(File file, boolean completed)
-
LargeText
public LargeText(File file, boolean completed, boolean transparentGunzip)
- Parameters:
transparentGunzip
- if set to true, this class will detect if the given file is compressed with GZIP. If so, it will transparently uncompress its content during read-access. Do note that the underlying file is not altered and remains compressed.- Since:
- 1.196
-
LargeText
public LargeText(File file, Charset charset, boolean completed, boolean transparentGunzip)
- Parameters:
transparentGunzip
- if set to true, this class will detect if the given file is compressed with GZIP. If so, it will transparently uncompress its content during read-access. Do note that the underlying file is not altered and remains compressed.- Since:
- 1.196
-
LargeText
public LargeText(ByteBuffer memory, boolean completed)
-
LargeText
public LargeText(ByteBuffer memory, Charset charset, boolean completed)
-
-
Method Detail
-
markAsComplete
public void markAsComplete()
-
isComplete
public boolean isComplete()
-
length
public long length()
-
readAll
public Reader readAll() throws IOException
ReturnsReader
for reading the raw bytes.- Throws:
IOException
-
writeLogTo
public long writeLogTo(long start, Writer w) throws IOException
- Throws:
IOException
-
writeLogTo
public long writeLogTo(long start, OutputStream out) throws IOException
Writes the tail portion of the file to theOutputStream
.- 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:
EOFException
- if the start position is larger than the file sizeIOException
-
doProgressText
public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException
Implements the progressive text handling. This method is used as a "web method" with progressiveText.jelly.- Throws:
IOException
-
setContentType
protected void setContentType(StaplerResponse rsp)
-
createWriter
protected Writer createWriter(StaplerRequest req, StaplerResponse rsp, long size) throws IOException
- Throws:
IOException
-
-