public abstract class Stream extends java.lang.Object implements Finalizable
Subclasses implement the specific read/write/seek workers that are specific to the type of stream they represent. These workers generally pass exceptions through to the caller and this class handles those exceptions that can be handled in a standard manner. The design is to ensure that the worker methods can be standardized and can be implemented with little effort. The following methods must be implemented:
assign(com.goldencode.p2j.util.Stream)
available()
getPos()
setPos(long)
getLen()
setLen(long)
writeByte(byte)
writeCh(char)
write(java.lang.String)
readCh()
readLn()
closeIn()
closeOut()
close()
Please note that many of these abstract methods may simply throw the
UnsupportedOperationException
if the underlying stream does
not support the operation in question.
Language statements that are supported:
Language Statement Java Equivalent --------------------- ---------------------- define streamStream(java.lang.String)
default constructor exportexport(com.goldencode.p2j.util.FieldEntry[])
(useswriteField(int)
orwriteBlock(com.goldencode.p2j.util.memptr)
) importreadField(com.goldencode.p2j.util.BaseDataType[])
orreadLine(com.goldencode.p2j.util.BaseDataType)
orreadBlock(com.goldencode.p2j.util.memptr)
input closecloseIn()
input from Stream subclass constructor input-output closeclose()
output closecloseOut()
output to Stream subclass constructor pageadvancePage()
putput(com.goldencode.p2j.util.FieldEntry[])
orputControl(com.goldencode.p2j.util.FieldEntry[])
orputUnformatted(com.goldencode.p2j.util.FieldEntry[])
(usesputField(int)
) readkeyreadChar()
seeksetPosition(com.goldencode.p2j.util.int64)
Built-in functions that are supported:
Function Java Equivalent --------------------- ---------------------- line-counterLanguage statements that have backing/helper support but which are fully implemented elsewhere:getNextLineNum()
page-numbergetPageNum()
page-sizegetPageSize()
seekgetPosition()
Language Statement Uses --------------------- ---------------------- prompt-forreadFieldWorker(com.goldencode.p2j.util.BaseDataType)
setreadFieldWorker(com.goldencode.p2j.util.BaseDataType)
updatereadFieldWorker(com.goldencode.p2j.util.BaseDataType)
Direct use of the putField(int)
, writeField(int)
and
writeBlock(com.goldencode.p2j.util.memptr)
output methods generate output to a buffer which must
first be initialized by startOutput(int)
. Once initialized, any number
of calls to such output methods may be done and all output will be gathered
into the same output buffer. To write this buffer to the stream, call
endOutput()
. Calls to the output methods must never be done outside
of a bracketed pair of matching startOutput
and
endOutput
calls otherwise the results will be undefined.
Within a given bracketed pair of matching startOutput
and
endOutput
calls, please do not mix the output of
putField
and writeField
. The results are
undefined.
Use of put(com.goldencode.p2j.util.FieldEntry[])
, putControl(com.goldencode.p2j.util.FieldEntry[])
, putUnformatted(com.goldencode.p2j.util.FieldEntry[])
and
export(com.goldencode.p2j.util.FieldEntry[])
DO NOT require the use of startOutput(int)
or
endOutput()
since they all handle buffering internally.
This class honors silent error mode (see ErrorManager
) if this
has been enabled. Otherwise, the end or error conditions are raised
(the appropriate exceptions are thrown). At this time, the error text
and error numbers are not fully implemented (many of the Progress
compatible values are unknown). In addition, the state of the stream
may be different from the Progress behavior in cases where an error is
raised.
Modifier and Type | Class and Description |
---|---|
static class |
Stream.PrintMode
Enum for representing the stream print modes
|
Modifier and Type | Field and Description |
---|---|
private boolean |
active
Flag denoting if the output buffer is currently being used.
|
private java.util.Set<AdvanceListener> |
advanceListeners
Objects to receive a notification when a page advance is issued.
|
protected boolean |
binary
Determines if control character translations occur or not.
|
private java.util.ArrayList<java.lang.String> |
buffer
Intermediate buffer of redirected terminal output.
|
private java.util.Map<CloseListener,java.lang.Object> |
closeListeners
Objects to receive a notification when a closeOut is issued.
|
private int |
column
Current column position on the line being written.
|
private boolean |
contiguous
While this flag is set, the current page will be written to ignoring
a page overflow condition.
|
private boolean |
control
Flag denoting if output modifies line/page counters.
|
protected boolean |
convert
Determines if standard character translations occur or not.
|
static int |
CR
The Carriage Return character
CR = 0x0D . |
private java.lang.String |
currentIn
Current input line being processed when reading fields.
|
private java.lang.StringBuilder |
currentOut
Current output line being processed when writing fields.
|
private char |
delim
Character used for delimiting import and export fields.
|
static char |
DELIM
The default delimiter to use for field level record reading.
|
private Stream.PrintMode |
displayMode
The print display mode of the stream
|
protected boolean |
doneIn
Flag denoting if input resources have already been cleaned up.
|
protected boolean |
doneOut
Flag denoting if output resources have already been cleaned up.
|
private boolean |
echo
Flag denoting if the UI functions that read input should echo it.
|
static char |
EOF
The
EOF character. |
private int |
flushLevel
Nesting level for
flushControlled(boolean) method invocations. |
private java.util.Set<FlushListener> |
flushListeners
Objects to receive a notification when a flush is issued.
|
private java.util.Set<RepeatedOutput> |
footers
List of footers are to be output (valid in paged mode).
|
private boolean |
footersEmitted
When the flag is true, the page-footers were emitted.
|
private int |
footerSize
Size of current footers to be output in lines.
|
private java.util.Set<RepeatedOutput> |
headers
List of headers that are to be output (valid in paged mode).
|
private int |
headerSize
Size of current headers to be output in lines.
|
protected static int |
increment
Number of milliseconds to pause between checks for input.
|
private int |
indexIn
Current index position into the line being read.
|
private boolean |
inHeaders
Flag indicating headers being output
|
private boolean |
isPut
Flag indicating a PUT statement is being used.
|
private int |
lastPageWithOutput
Field indicating what page had output last
|
static int |
LF
The Line Feed character
LF = 0x0A . |
static int |
MODE_EXPORT
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char) mode for an EXPORT statement. |
static int |
MODE_PUT_CONTROL
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char) mode for a PUT CONTROL statement. |
static int |
MODE_PUT_NORMAL
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char) mode for a standard PUT statement. |
static int |
MODE_PUT_UNFORMATTED
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char) mode for a PUT UNFORMATTED statement. |
private java.lang.String |
name
Name of the stream variable used in the legacy 4GL source code.
|
static java.lang.String |
NEWLINE
The line separator character(s) for the current platform.
|
static int |
NEWLINE_LEN
The length if line separator.
|
private int |
nextLineNum
Line number of the next line to be output on the current page.
|
private boolean |
nullQuirk
Flag to detect if a dropped data occurred in line reading.
|
static int |
PAGED_DEFAULT
The default number of lines per page when in paged mode (56).
|
private java.util.Map<PageBreakListener,java.lang.Object> |
pageListeners
Objects to receive a notification when a page break is written.
|
private int |
pageNum
Current page number for the output stream.
|
private int |
pageSize
Lines of output per page or 0 for non-paged output.
|
private int |
pendingRowCount
Number of rows pending in RemoteTerminal.
|
static java.lang.String |
PIPE_BROKEN_MESSAGE
Message that indicates that pipe to subprocess has been broken.
|
private boolean |
pulseOnClose
Flag to mark pulse on close action.
|
private boolean |
savedPut
The flag saves the put parameter in the putWorker method; used if we
need to restart the output.
|
static int |
SET_PAGED_DEFAULT
The special value which triggers setting of default number of lines per page in paged mode.
|
protected java.lang.String |
sourceCp
Source codepage for character conversion.
|
private boolean |
suppressFormFeed
When the flag is true due to editor(s), the next form feed will be skipped.
|
protected java.lang.String |
targetCp
Target codepage for character conversion.
|
private boolean |
trailingNL
Track trailing NEWLINE state
|
private boolean |
trailingWithoutPutNL
Track trailing NEWLINE state
|
private boolean |
unbuffered
Determines whether the stream is UNBUFFERED
|
private boolean |
unformatted
Flag denoting if the output is unformatted.
|
private boolean |
unnamed
If
true , this is an unnamed stream. |
Constructor and Description |
---|
Stream()
Default constructor which does nothing.
|
Stream(java.lang.String name)
Construct an instance associated with a specific legacy 4GL variable name.
|
Modifier and Type | Method and Description |
---|---|
void |
advancePage()
Inserts a page break if the stream is paged and if the next write
position is not on the first line of a new page.
|
protected void |
afterWrite()
This method should be called after each write operation.
|
private void |
append(char data)
Append the given
char to the output buffer and maintain
the column counter. |
private void |
append(java.lang.String data)
Append the given string to the output buffer and maintain the column
counter.
|
abstract void |
assign(Stream stream)
Assigns the internal stream reference to the given reference.
|
static void |
assignDatum(BaseDataType var,
java.lang.String value)
Assign a value derived from a string into a data wrapper variable.
|
abstract long |
available()
The number of bytes available to be immediately read without blocking.
|
private void |
checkForPageBreak()
This method is a custom algorithm for page-break checking - the skip
option with a put stream ...
|
protected void |
cleanup(boolean in,
boolean out)
Perform common close preprocessing for all streams (should be
called at the beginning of each sub-classes'
close()
method. |
abstract void |
close()
Closes both the input and output streams and releases OS resources
associated with it.
|
abstract void |
closeIn()
Closes the input stream and releases OS resources associated with it.
|
abstract void |
closeOut()
Closes the output stream and releases OS resources associated with it.
|
void |
deleted()
Provides a notification that the external program scope in which the object is registered is
is being deleted and the object's reference will be lost after this method is called.
|
void |
deregisterFooter(RepeatedOutput foot)
Removes a footer from the list of those footers that will be output at
the bottom of every page (even a last partial page).
|
void |
deregisterHeader(RepeatedOutput head)
Removes a header from the list of those headers that will be output at the
top of every new page.
|
void |
endOutput()
Write the current output buffer to the stream.
|
void |
endOutput(boolean appendNewLine)
Write the current output buffer to the stream.
|
void |
export(FieldEntry[] data)
Output a list of fields with export formatting to the stream.
|
private void |
extendPage()
Extend the output of a partial page (with blank lines) to the end of
valid output so that any footer and a form feed can be output to
terminate the page at the proper minimum length.
|
void |
finished()
Processes the notification that the scope in which the stream was
instantiated is ending and the object's reference will be lost after
this method is called.
|
void |
flush()
This method does nothing if the stream is in
control mode. |
int |
flushControlled(boolean bypass)
Writes the data previously buffered (via
writeControlled(java.lang.String) ) to
the stream. |
protected void |
flushData()
Flushes this output stream and forces any buffered output bytes to be written out.
|
void |
forcePageBreak()
Force new output page.
|
void |
forcePageBreak(boolean headers)
Force new output page.
|
private java.lang.String |
generateFormattedText(BaseDataType val,
java.lang.String fmt)
Generates formatted data in conformity with PUT / PUT UNFORMATTED / PUT
CONTROL specifications.
|
static java.lang.String |
generateStringFormat(java.lang.String fmt,
int len)
Generate the default format string of 'x(N)' will be used (where N is
the length of the value) IF AND ONLY IF the given input format string
is
null . |
int |
getAvailableLines()
Gets the number of available lines (free space) on the current output
page.
|
boolean |
getControl()
Gets the stream's control mode flag which defines whether subsequent
characters written to the stream will affect line/page counters.
|
boolean |
getConvert()
Gets the stream's character conversion mode.
|
char |
getDelimiter()
Gets the stream's field import/export delimiter character.
|
Stream.PrintMode |
getDisplayMode()
Returns the display mode of the stream.
|
boolean |
getEcho()
Gets the stream's echo mode which causes UI statements that read
data from a stream to echo that data to the current output destination.
|
int |
getEffectivePageSize()
Gets the number of lines on the page excluding footers.
|
abstract long |
getLen()
The length of the stream in bytes.
|
int64 |
getLength()
The length of the stream in bytes.
|
java.lang.String |
getName()
Get the name of the stream variable used in the legacy 4GL source code.
|
integer |
getNextLineNum()
Accesses the line number of the next line to be output on the current page.
|
integer |
getPageNum()
Accesses the current page number in an output stream.
|
integer |
getPageSize()
Accesses the number of lines per page in an output stream, where 0
indicates that this stream is not paged.
|
int |
getPendingRowCount()
Number of lines pending for output but not buffered in local stream
buffer.
|
abstract long |
getPos()
The 0-based offset into the stream at which the next read or write will
occur.
|
int64 |
getPosition()
Obtains the current read and/or write position in the stream, if the stream type supports
such a query.
|
boolean |
getPulseOnClose()
Detects if need to make a pulse on a empty redirected frame stream.
|
boolean |
getUnformatted()
Gets the stream's unformatted mode flag.
|
boolean |
hasPageHeadersFooters()
Checks if this is a paged stream and that it has at least 1 header or
footer registered.
|
protected int |
indexOfNewLine(java.lang.StringBuilder sb)
Helper method to search the position of the new line string in a given
text buffer.
|
boolean |
isContiguous()
Gets the contiguous mode state.
|
boolean |
isFreshPage()
Returns an indication of whether the current page has received any
output yet.
|
abstract boolean |
isIn()
State of the input side of the stream.
|
abstract boolean |
isOut()
State of the output side of the stream.
|
boolean |
isSilent()
Check if stream is in silent mode.
|
boolean |
isSuppressFormFeed()
State of the suppress form feed flag.
|
boolean |
isTerm()
Check if current stream is bound to terminal.
|
boolean |
isUnbuffered()
Determines whether the stream is UNBUFFERED.
|
boolean |
isUnnamed()
Checks this stream redirection type: named or unnamed.
|
boolean |
isValid()
Checks if the stream is alive or not.
|
void |
iterate()
Processes the iterate notification provided by the
TransactionManager . |
boolean |
needsHeadersOutput()
Detects if headers need to be output.
|
(package private) boolean |
needsPageBreak()
Detects when a page break is needed.
|
(package private) boolean |
needsPageBreak(int add)
Detects when a page break is needed.
|
abstract int |
peekCh()
Peeks at the character from the current read position in the stream (reads a character from
the current read position in the stream without incrementing stream read position.
|
private void |
processAdvanceNotifications()
Notify all registered listeners that this stream is advancing page.
|
private void |
processCloseNotifications()
Notify all registered listeners that this stream is being closed.
|
void |
processFooters()
Output any registered footers in a LIFO order.
|
void |
processHeaders()
Detects if output is being generated on a new page and renders the
header(s) if needed.
|
void |
processHeadersInt()
Detects if output is being generated on a new page and renders the
header(s) if needed.
|
void |
processHeadersUncond()
Detects if output is being generated on a new page and renders the
header(s) if needed.
|
private void |
processLineEnd(boolean conditional,
boolean noPageBreak)
Add a line end and if in paged output mode and the current page is
full, add a page break (the form feed character 0x0C) to the current
write buffer and maintain the next line number and current page number.
|
private void |
processPageBreak()
If in paged output mode and the current page is full, add a page break
(the form feed character 0x0C) to the current write buffer and maintain
the next line number and current page number.
|
private void |
processPageBreakNotifications()
Notify all registered listeners that a page break has been written for
this stream.
|
private void |
processRendering(java.util.Set<RepeatedOutput> out,
boolean footers)
Iterate through the given set of
RepeatedOutput instances and
for each element, invoke the RepeatedOutput.render(com.goldencode.p2j.util.Stream) method. |
private void |
processUnbindNotifications()
Notify all registered listeners that this stream is dead.
|
boolean |
protectReads()
Raise an ERROR condition if the caller cannot input from the stream due
to the input source being closed or never having been opened.
|
boolean |
protectWrites()
Raise an ERROR condition if the caller cannot output to the stream due
to the output destination being closed or never having been opened.
|
void |
pulseOutput()
Notifies the stream that an empty drawing has occurred.
|
void |
put(FieldEntry[] data)
Output a list of fields with specified formatting to the stream.
|
void |
putControl(FieldEntry[] data)
Output a list of fields (without buffering) to the stream.
|
void |
putField(BaseDataType val)
Append the value to the output buffer with the default type-specific
format string at the current output column.
|
void |
putField(BaseDataType val,
boolean starts,
int col)
Append the value to the output buffer with the default type-specific
format string at the current output column.
|
void |
putField(BaseDataType val,
boolean starts,
NumberType col)
Append the value to the output buffer with the default type-specific
format string at the current output column.
|
void |
putField(BaseDataType val,
java.lang.String fmt)
Append the value to the output buffer with the given type-specific
format string at the current output column.
|
void |
putField(BaseDataType val,
java.lang.String fmt,
boolean starts,
int col)
Append the value to the output buffer with the given type-specific
format string at the current output column.
|
void |
putField(BaseDataType val,
java.lang.String fmt,
boolean starts,
NumberType col)
Append the value to the output buffer with the given type-specific
format string at the current output column.
|
void |
putField(boolean val)
Append the
boolean value to the output buffer with the
default format string of 'yes/no' at the current output column. |
void |
putField(boolean val,
boolean starts,
int col)
Append the
boolean value to the output buffer with the
default format string of 'yes/no' at the current output column. |
void |
putField(boolean val,
boolean starts,
NumberType col)
Append the
boolean value to the output buffer with the
default format string of 'yes/no' at the current output column. |
void |
putField(boolean val,
java.lang.String fmt)
Append the
boolean value to the output buffer with the
given format string at the current output column. |
void |
putField(boolean val,
java.lang.String fmt,
boolean starts,
int col)
Append the
boolean value to the output buffer with the
given format string at the current output column. |
void |
putField(boolean val,
java.lang.String fmt,
boolean starts,
NumberType col)
Append the
boolean value to the output buffer with the
given format string at the current output column. |
void |
putField(double val)
Append the
double value to the output buffer with the
default format string of '->>,>>9.99' at the current output column. |
void |
putField(double val,
boolean starts,
int col)
Append the
double value to the output buffer with the
default format string of '->>,>>9.99' at the current output column. |
void |
putField(double val,
boolean starts,
NumberType col)
Append the
double value to the output buffer with the
default format string of '->>,>>9.99' at the current output column. |
void |
putField(double val,
java.lang.String fmt)
Append the
double value to the output buffer with the
given format string at the current output column. |
void |
putField(double val,
java.lang.String fmt,
boolean starts,
int col)
Append the
double value to the output buffer with the
given format string at the current output column. |
void |
putField(double val,
java.lang.String fmt,
boolean starts,
NumberType col)
Append the
double value to the output buffer with the
given format string at the current output column. |
void |
putField(int val)
Append the
int value to the output buffer with the default
format string of '->,>>>,>>9' at the current output column. |
void |
putField(int val,
boolean starts,
int col)
Append the
int value to the output buffer with the default
format string of '->,>>>,>>9' at the current output column. |
void |
putField(int val,
boolean starts,
NumberType col)
Append the
int value to the output buffer with the default
format string of '->,>>>,>>9' at the current output column. |
void |
putField(int val,
java.lang.String fmt)
Append the
int value to the output buffer with the given
format string at the current output column. |
void |
putField(int val,
java.lang.String fmt,
boolean starts,
int col)
Append the
int value to the output buffer with the given
format string at the current output column. |
void |
putField(int val,
java.lang.String fmt,
boolean starts,
NumberType col)
Append the
int value to the output buffer with the given
format string at the current output column. |
void |
putField(java.lang.String val)
Append the
String value to the output buffer with a
format string of 'x(N)' (where N is the length of the value) at the
current output column. |
void |
putField(java.lang.String val,
boolean starts,
int col)
Append the
String value to the output buffer with the
default format string of 'x(N)' will be used (where N is the length of
the value) at the current output column. |
void |
putField(java.lang.String val,
boolean starts,
NumberType col)
Append the
String value to the output buffer with the
default format string of 'x(N)' will be used (where N is the length of
the value) at the current output column. |
void |
putField(java.lang.String val,
java.lang.String fmt)
Append the
String value to the output buffer with the
given format string at the current output column. |
void |
putField(java.lang.String val,
java.lang.String fmt,
boolean starts,
int col)
Append the
String value to the output buffer with the
given format string at the current output column. |
void |
putField(java.lang.String val,
java.lang.String fmt,
boolean starts,
NumberType col)
Append the
String value to the output buffer with the
given format string at the current output column. |
void |
putLineEnd()
Append a platform-specific line-end to the current output buffer if
the output is not already positioned at the beginning of a line OR
if in
control mode. |
void |
putLineEnd(int num)
Append the specified number of platform-specific line-ends to the
current output buffer.
|
void |
putNull()
Append a null character '\0' to the current output buffer.
|
void |
putNull(int num)
Append the given number of null characters '\0' to the current output
buffer.
|
void |
putSpace()
Append a space to the current output buffer.
|
void |
putSpace(int num)
Append the given number of spaces to the current output buffer.
|
void |
putUnformatted(FieldEntry[] data)
Output a list of fields with default formatting to the stream.
|
void |
putWorker(FieldEntry[] data,
int mode,
char delim)
Output a list of fields to the stream.
|
(package private) int |
rawGetNextLineNum()
Gets the current page's next line number.
|
(package private) int |
rawGetPageNum()
Gets the current page number.
|
(package private) int |
rawGetPageSize()
Gets the current page size in lines.
|
(package private) void |
rawIncrementNextLineNum()
Increments the current page's next line number.
|
(package private) void |
rawIncrementPageNum()
Increments the current page number.
|
int |
rawNextLineNum()
Accesses the line number of the next line to be output on the current page.
|
int |
rawPageSize()
Accesses the number of lines per page in an output stream, where 0
indicates that this stream is not paged.
|
(package private) void |
rawResetNextLineNum()
Resets the current page's next line number to 1.
|
(package private) void |
rawSetPageSize(int sz)
Sets the current page size in lines.
|
void |
readBlock(memptr var)
Read a block of data from the stream with the block size equal to the
size of the binary data array in the given
memptr variable. |
abstract int |
readCh()
Read a character from the current read position in the stream and increment stream pointer.
|
integer |
readChar()
Read a character from the stream, blocking until input is received.
|
integer |
readChar(int pause)
Read a character from the stream, pausing until input is received or
the requested number of seconds have elapsed.
|
byte[] |
readChunk(int len)
Read a chunk of bytes from the current read position in the stream to the
offset calculated by given length or to the
EOF , whichever
comes first. |
void |
readField(BaseDataType var)
Read the next field from the current line buffer using the previously
specified delimiter using
setDelimiter(char) or the default
delimiter of DELIM before assigning the data into the given
variable var . |
void |
readField(BaseDataType[] var)
Read the fields from the current line buffer using the previously
specified delimiter using
setDelimiter(char) or the default
delimiter of DELIM before assigning the data into the given
variable var elements in the order the data was read. |
void |
readField(FieldReference ref)
Read the next field from the current line buffer using the previously
specified delimiter using
setDelimiter(char) or the default
delimiter of DELIM before assigning the data using the given
database field reference ref . |
void |
readField(ImportFieldExpansion f) |
java.lang.String |
readFieldWorker(BaseDataType var)
Read the next field from the current line buffer using the previously
specified delimiter using
setDelimiter(char) or the default
delimiter of DELIM . |
void |
readLine(BaseDataType var)
Read a complete line without regard to the normal Progress formatted
field processing rules or delimiters.
|
protected java.lang.String |
readLineCleanup(java.lang.StringBuilder sb)
Remove the new line character(s) from the given buffer and return the
rest of the buffered text as a string.
|
private java.lang.String |
readLineDropNull()
Read the next line from the stream dropping all data at and after any
null character including the next newline . |
abstract java.lang.String |
readLn()
Read all characters from the current read position in the stream to the
next line separator (as determined by the
File.separator
or to the EOF . |
private java.lang.String |
readNextLine(boolean inString)
Read the next line from the stream using Progress rules.
|
void |
registerAdvanceListener(AdvanceListener al)
Adds a listener to the list of those objects that will get a
notification when this stream gets page advance order.
|
void |
registerCloseListener(CloseListener cl)
Adds a listener to the list of those objects that will get a
notification when this stream is about to be closed.
|
void |
registerFlushListener(FlushListener fl)
Adds a listener to the list of those objects that will get a
notification when this stream is about to be flushed.
|
void |
registerFooter(RepeatedOutput foot)
Adds a footer to the list of those footers that will be output at the
bottom of every page (even a last partial page).
|
void |
registerHeader(RepeatedOutput head)
Adds a header to the list of those headers that will be output at the
top of every new page.
|
void |
registerPageBreakListener(PageBreakListener pl)
Adds a listener to the list of those objects that will get a
notification at the top of every new page (except for the first
page).
|
private java.lang.String |
reload(boolean inString)
Obtain the next line of input and translate any errors or exceptional
conditions into their Progress equivalents.
|
void |
resetCurrentLine()
Resets the internal buffer which holds the current line being parsed
and the current index into that buffer.
|
void |
retry()
Processes the retry notification provided by the
TransactionManager . |
void |
setAppend()
Set the current stream's read/write position to the end of the file
such that future writes are appending to the file.
|
void |
setBinary()
Sets the stream into binary mode which disables character translations
during
readChar() . |
void |
setContiguous(boolean contiguous)
Sets contiguous mode for the current page.
|
void |
setControl(boolean mode)
Sets the stream into control mode which ensures that subsequent
characters written to the stream will not affect line/page counters.
|
void |
setConvert(boolean convert)
Sets the stream's character conversion mode.
|
void |
setConvertSource(character cp)
Sets the stream's source codepage and activates character conversion mode.
|
void |
setConvertSource(java.lang.String cp)
Sets the stream's source codepage and activates character conversion mode.
|
void |
setConvertTarget(character cp)
Sets the stream's target codepage and activates character conversion mode.
|
void |
setConvertTarget(java.lang.String cp)
Sets the stream's target codepage and activates character conversion mode.
|
void |
setDelimiter(char delim)
Sets the stream's delimiter character for import/export of fields.
|
void |
setDelimiter(java.lang.String delim)
Sets the stream's delimiter character for import/export of fields.
|
void |
setEcho(boolean echo)
Sets the stream into echo mode which causes UI statements that read
data from a stream to echo that data to the current output destination.
|
void |
setFont(int num)
Sets the stream font number.
|
void |
setFont(NumberType num)
Sets the stream font number.
|
void |
setLandscape()
Set stream display mode to landscape
|
abstract void |
setLen(long len)
Truncates or extends the stream to the specified length if this stream
supports such an operation.
|
void |
setName(java.lang.String name)
Set the name of the stream variable used in the legacy 4GL source code.
|
void |
setPageSize()
Sets the number of lines per page in an output stream to the
PAGED_DEFAULT or to terminal height for TerminalStream . |
void |
setPageSize(double size)
Sets the number of lines per page in an output stream, where 0
indicates that this stream is not paged.
|
void |
setPageSize(NumberType size)
Sets the number of lines per page in an output stream, where 0
indicates that this stream is not paged.
|
void |
setPendingRowCount(int rows)
Notify stream about pending rows.
|
void |
setPortrait()
Set stream display mode to portrait
|
abstract void |
setPos(long pos)
Moves the current read/write position to the specified absolute 0-based
offset.
|
void |
setPosition(int64 newpos)
Sets the current read and/or write position in the stream, if the stream type supports the
operation.
|
void |
setPosition(long newpos)
Sets the current read and/or write position in the stream, if the
stream type supports the operation.
|
void |
setPulseOnClose(boolean pulseOnClose)
Sets the need to pulse on close flag.
|
private void |
setTrailingNL(boolean trailingNL)
Set the NEWLINE state.
|
void |
setUnbuffered()
Makes the stream UNBUFFERED.
|
void |
setUnformatted(boolean fmt)
Sets the stream into unformatted mode which disables default format
processing in
putField(int) . |
void |
setUnnamed(boolean unnamed)
Marks this stream as being named or unnamed.
|
void |
skipField()
Move the index into the current line buffer past the next instance of
the specified delimiter using
setDelimiter(char) or the default
delimiter of DELIM and then return. |
protected boolean |
skipLoneHyphenInput()
Indicate whether or not a lone hyphen on input should be ignored;
normal IMPORT statement processing considers this a blank field.
|
void |
startOutput(int newColumn)
Create the buffer to gather all output of
putField(int) ,
putSpace() , putLineEnd() and writeField(int) methods. |
abstract void |
write(byte[] data)
Write the given byte array to the output stream.
|
abstract void |
write(byte[] data,
int off,
int len)
Write the specified range of bytes from the given byte array to the output stream.
|
abstract void |
write(java.lang.String data)
Write the given string to the output stream.
|
void |
writeBlock(memptr val)
Write the entire block of data (as represented by the given
memptr ) to the stream with no delimiters, end of line
insertions or other modifications. |
abstract void |
writeByte(byte b)
Write the given byte to the output stream.
|
abstract void |
writeCh(char ch)
Write the given character to the output stream.
|
void |
writeControlled(java.lang.String txt)
Writes the given data into a buffer appending a newline to the end.
|
void |
writeControlledSpecial(java.lang.String txt,
int lines)
Supports writing form feeds and intermediate headers.
|
void |
writeField(BaseDataType val)
Write a field to the stream using the previously specified delimiter
(using
setDelimiter(char) ) or the default delimiter of
DELIM in between each field. |
void |
writeField(boolean val)
Write a field to the stream using the previously specified delimiter
(using
setDelimiter(char) ) or the default delimiter of
DELIM in between each field. |
void |
writeField(double val)
Write a field to the stream using the previously specified delimiter
(using
setDelimiter(char) ) or the default delimiter of
DELIM in between each field. |
void |
writeField(int val)
Write a field to the stream using the previously specified delimiter
(using
setDelimiter(char) ) or the default delimiter of
DELIM in between each field. |
void |
writeField(java.lang.String val)
Write a field to the stream using the previously specified delimiter
(using
setDelimiter(char) ) or the default delimiter of
DELIM in between each field. |
private void |
writeNewLine()
Add the platform-specific new line to the current write buffer.
|
private void |
writePageBreak()
Add any needed footer(s) and then a page break (the form feed character
0x0C) to the current stream (buffered or not buffered), then increment
the current page number and reset the next line number to 1.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initFailure
public static final char DELIM
public static final java.lang.String NEWLINE
public static final int NEWLINE_LEN
public static final int SET_PAGED_DEFAULT
public static final int PAGED_DEFAULT
public static final char EOF
EOF
character.public static final int CR
CR = 0x0D
.public static final int LF
LF = 0x0A
.public static final int MODE_PUT_NORMAL
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char)
mode for a standard PUT statement.public static final int MODE_PUT_CONTROL
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char)
mode for a PUT CONTROL statement.public static final int MODE_PUT_UNFORMATTED
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char)
mode for a PUT UNFORMATTED statement.public static final int MODE_EXPORT
putWorker(com.goldencode.p2j.util.FieldEntry[], int, char)
mode for an EXPORT statement.public static final java.lang.String PIPE_BROKEN_MESSAGE
protected static final int increment
protected boolean doneIn
protected boolean doneOut
protected boolean convert
protected java.lang.String sourceCp
protected java.lang.String targetCp
protected boolean binary
private int pageNum
private int pageSize
private int nextLineNum
private java.lang.String currentIn
private int indexIn
private java.lang.StringBuilder currentOut
private int column
private boolean active
private Stream.PrintMode displayMode
private boolean unformatted
private boolean echo
private boolean control
private boolean nullQuirk
private char delim
private java.util.Set<RepeatedOutput> headers
private int headerSize
private java.util.Set<RepeatedOutput> footers
private int footerSize
private java.util.ArrayList<java.lang.String> buffer
private int flushLevel
flushControlled(boolean)
method invocations.private java.util.Map<PageBreakListener,java.lang.Object> pageListeners
private java.util.Map<CloseListener,java.lang.Object> closeListeners
private java.util.Set<AdvanceListener> advanceListeners
private java.util.Set<FlushListener> flushListeners
private boolean inHeaders
private boolean trailingNL
private boolean trailingWithoutPutNL
private int lastPageWithOutput
private boolean savedPut
private boolean isPut
private boolean footersEmitted
private boolean contiguous
private boolean unnamed
true
, this is an unnamed stream.private boolean suppressFormFeed
private boolean unbuffered
private java.lang.String name
private int pendingRowCount
private boolean pulseOnClose
public Stream()
public Stream(java.lang.String name)
name
- The legacy variable name.public static void assignDatum(BaseDataType var, java.lang.String value)
var
- Variable into which datum is assigned.value
- String value of the datum to be assigned.public integer getNextLineNum()
public int rawNextLineNum()
public integer getPageNum()
public integer getPageSize()
public int rawPageSize()
public void setPageSize(NumberType size)
size
- The number of lines per page of output or 0 if the output
is not paged. If the input value is unknown
no change will be made.public void setPageSize(double size)
size
- The number of lines per page of output or 0 if the output
is not paged.public void setPageSize()
PAGED_DEFAULT
or to terminal height for TerminalStream
.public void setBinary()
readChar()
. It is important to note that field and line
reading (import
, set
, update
prompt-for
and import unformatted
) are
unaffected by this setting (this is based on Progress testcases).public void setConvert(boolean convert)
convert
- The new character conversion mode. true
to
enable character conversion, false
to disable
conversion.public boolean getConvert()
true
means that character
conversion is enabled.public void setConvertSource(java.lang.String cp)
cp
- The source codepage for character conversion mode.public void setConvertSource(character cp)
cp
- The source codepage for character conversion mode.public void setConvertTarget(java.lang.String cp)
cp
- The target codepage for character conversion mode.public void setConvertTarget(character cp)
cp
- The target codepage for character conversion mode.public void setEcho(boolean echo)
true
then the output will be echoed, but if
either stream has echo as false
, no echoing will be done.
Note that this only affects UI statements that are not operating
against the terminal.echo
- The new echo mode.public boolean getEcho()
true
then the output will be echoed, but if
either stream has echo as false
, no echoing will be done.
Note that this only affects UI statements that are not operating
against the terminal.public boolean getUnformatted()
true
, all output is in a raw unformatted
mode unless overridden by an explicit format string.public void setUnformatted(boolean fmt)
putField(int)
.fmt
- If true
, all output is in a raw unformatted
mode unless overridden by an explicit format string.public boolean getControl()
Warning: in Progress this is described as ensuring that the "position" (presumably the write position) will not be changed when this option is enabled. However, this really does not make any sense in the case where output characters are used for control purposes. No support is provided for this case.
true
, all output is emitted without
modification of line/page counters.public void setControl(boolean mode)
Warning: in Progress this is described as ensuring that the "position" (presumably the write position) will not be changed when this option is enabled. However, this really does not make any sense in the case where output characters are used for control purposes. No support is provided for this case.
mode
- If true
, all output is emitted without
modification of line/page counters.public char getDelimiter()
char
(defaults to
DELIM
.public void setDelimiter(char delim)
delim
- The current delimiter char
.public void setLandscape()
public void setPortrait()
public Stream.PrintMode getDisplayMode()
Possible values: LANDSCAPE, PORTRAIT and NONE.
PrintMode
enum values.public boolean isUnnamed()
true
if this is an unnamed stream.public void setUnnamed(boolean unnamed)
unnamed
- If true
, then this stream is unnamed.public void setUnbuffered()
public boolean isUnbuffered()
true
if the stream is UNBUFFERED.public void setDelimiter(java.lang.String delim)
delim
- The current delimiter char
(if this is not
a single character, only the first character will be used).
If null
or an empty string, the delimiter is
reset to the default of DELIM
.public java.lang.String getName()
public void setName(java.lang.String name)
name
- The legacy variable name.public boolean protectReads()
true
if the calling code should silently return
which will occur if the condition would have been raised but
wasn't due to NO-ERROR protection (silent error mode). Will
return false
if it is OK to read from the stream.public boolean protectWrites()
true
if the calling code should silently return
which will occur if the condition would have been raised but
wasn't due to NO-ERROR protection (silent error mode). Will
return false
if it is OK to write to the stream.public boolean isSilent()
false
, by default all streams are verbose.public integer readChar()
The exact character read from the input stream will be returned,
except that when binary
mode is false, all 0x0A characters
(line feeds) are converted into a 0x0D (carriage return or a Progress
"RETURN" key).
The underlying stream subclass determines the content of the result.
Byte oriented streams such as pipes or files will return a byte while
streams that generate keystrokes or characters may return a DBCS or
Unicode character. Please see the readCh()
method of the
subclass to obtain more information.
EOF
.public integer readChar(int pause) throws StopConditionException
The exact character read from the input stream will be returned,
except that when binary
mode is false, all 0x0A characters
(line feeds) are converted into a 0x0D (carriage return or a Progress
"RETURN" key).
The underlying stream subclass determines the content of the result.
Byte oriented streams such as pipes or files will return a byte while
streams that generate keystrokes or characters may return a DBCS or
Unicode character. Please see the readCh()
method of the
subclass to obtain more information.
pause
- The seconds to wait. If this is negative, the pause is
ignored and the wait is indefinite. If 0, there is an
immediate return of -1 if no character is available for
reading.EOF
.StopConditionException
- If any interruption occurs during I/O processing.public void resetCurrentLine()
readField(com.goldencode.p2j.util.BaseDataType[])
processing has occurred for a given line.
This also resets the current delimiter to the default.
public void readField(BaseDataType[] var) throws EndConditionException, ErrorConditionException
setDelimiter(char)
or the default
delimiter of DELIM
before assigning the data into the given
variable var
elements in the order the data was read. The
number of fields read is equal to the number of elements in the array.
Parsing is done using readFieldWorker(com.goldencode.p2j.util.BaseDataType)
.
If the current line buffer is empty, a new line will be read from the stream.
In the following conditions, no assignment will be made:
var
element is null
(the caller
wants the field to be read and the index incremented but the
contents are ignored), this is equivalent to skipField()
After all field reads for a given line are complete,
resetCurrentLine()
must be called to enable input for the
next line. Otherwise, all subsequent reads will continue trying to
read from the current line. This will result in reading data left on
the current line or reading nothing if the line has already been fully
read. resetCurrentLine
notifies the stream environment
that it should move to processing the next line.
var
- The array of elements to which the results are assigned. Must
not be null
, but any given element in the array
may be null
.EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.public void readField(ImportFieldExpansion f)
public void readField(FieldReference ref) throws EndConditionException, ErrorConditionException
setDelimiter(char)
or the default
delimiter of DELIM
before assigning the data using the given
database field reference ref
.
Parsing is done using readFieldWorker(com.goldencode.p2j.util.BaseDataType)
.
If the current line buffer is empty, a new line will be read from the stream.
In the following conditions, no assignment will be made:
ref
reference is null
(the caller
wants the field to be read and the index incremented but the
contents are ignored), this is equivalent to skipField()
After all field reads for a given line are complete,
resetCurrentLine()
must be called to enable input for the
next line. Otherwise, all subsequent reads will continue trying to
read from the current line. This will result in reading data left on
the current line or reading nothing if the line has already been fully
read. resetCurrentLine
notifies the stream environment
that it should move to processing the next line.
ref
- The database field reference using which the result is
assigned.EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.public void readField(BaseDataType var) throws EndConditionException, ErrorConditionException
setDelimiter(char)
or the default
delimiter of DELIM
before assigning the data into the given
variable var
.
Parsing is done using readFieldWorker(com.goldencode.p2j.util.BaseDataType)
.
If the current line buffer is empty, a new line will be read from the stream.
In the following conditions, no assignment will be made:
var
reference is null
(the caller
wants the field to be read and the index incremented but the
contents are ignored), this is equivalent to skipField()
After all field reads for a given line are complete,
resetCurrentLine()
must be called to enable input for the
next line. Otherwise, all subsequent reads will continue trying to
read from the current line. This will result in reading data left on
the current line or reading nothing if the line has already been fully
read. resetCurrentLine
notifies the stream environment
that it should move to processing the next line.
var
- The variable to which the result is assigned.EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.public void readBlock(memptr var) throws EndConditionException, ErrorConditionException
memptr
variable.
The data will be written into the memptr starting at the first byte
in the array. The read data will be the smaller of the block size or
the file size. Only an error or end of file condition will cause this
read to terminate before the block size has been read.var
- The variable to which the result is assigned.EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.public java.lang.String readFieldWorker(BaseDataType var) throws EndConditionException, ErrorConditionException, StopConditionException
setDelimiter(char)
or the default
delimiter of DELIM
.
If the current line buffer is empty, a new line will be read from the stream.
In the following conditions, a null
return value will be
provided:
var
parameter is null
(the caller
wants the field to be read and the index incremented but the
contents are ignored)
After all field reads for a given line are complete,
resetCurrentLine()
must be called to enable input for the
next line. Otherwise, all subsequent reads will continue trying to
read from the current line. This will result in reading data left on
the current line or reading nothing if the line has already been fully
read. resetCurrentLine
notifies the stream environment
that it should move to processing the next line.
var
- If null
the next field read will be discarded
instead of returned.null
(see
above).EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.StopConditionException
- If any interruption occurs during I/O processing.public void skipField() throws EndConditionException, ErrorConditionException
setDelimiter(char)
or the default
delimiter of DELIM
and then return.
If the current line buffer is empty, a new line will be read from the stream.
After all field reads for a given line are complete,
resetCurrentLine()
must be called to enable input for the
next line. Otherwise, all subsequent reads will continue trying to
read from the current line. This will result in reading data left on
the current line or reading nothing if the line has already been fully
read. resetCurrentLine
notifies the stream environment
that it should move to processing the next line.
EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.public void readLine(BaseDataType var) throws EndConditionException, ErrorConditionException, StopConditionException
var
- The BaseDataType
variable to which the result is
assigned. This is contrary to Progress docs which state that
the field must be a character
field (the docs
are incorrect).EndConditionException
- On EOF.ErrorConditionException
- On any error during I/O.StopConditionException
- If any interruption occurs during I/O processing.public void writeField(int val) throws ErrorConditionException
setDelimiter(char)
) or the default delimiter of
DELIM
in between each field. All output will be formatted
using the toStringExport
method of the associated
type.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The value to be output.ErrorConditionException
- On any error during I/O.public void writeField(double val) throws ErrorConditionException
setDelimiter(char)
) or the default delimiter of
DELIM
in between each field. All output will be formatted
using the toStringExport
method of the associated
type.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The value to be output.ErrorConditionException
- On any error during I/O.public void writeField(boolean val) throws ErrorConditionException
setDelimiter(char)
) or the default delimiter of
DELIM
in between each field. All output will be formatted
using the toStringExport
method of the associated
type.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The value to be output.ErrorConditionException
- On any error during I/O.public void writeField(java.lang.String val) throws ErrorConditionException
setDelimiter(char)
) or the default delimiter of
DELIM
in between each field. All output will be formatted
using the toStringExport
method of the associated
type.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The value to be output.ErrorConditionException
- On any error during I/O.public void writeField(BaseDataType val) throws ErrorConditionException
setDelimiter(char)
) or the default delimiter of
DELIM
in between each field. All output will be formatted
using the toStringExport
method of the associated
type.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The value to be output.ErrorConditionException
- On any error during I/O.public void writeBlock(memptr val) throws ErrorConditionException, StopConditionException
memptr
) to the stream with no delimiters, end of line
insertions or other modifications. All output will be formatted
using the toStringExport
method of the associated
type.
Use of this method does NOT require bracketing between
startOutput(int)
and endOutput()
methods and these must
not be called otherwise the result is undefined.
val
- The value to be output.ErrorConditionException
- On any error during I/O.StopConditionException
- If any interruption occurs during I/O processing.public void advancePage() throws ErrorConditionException
startOutput(int)
and endOutput()
.
This means that this method should never be called while there is
a current startOutput
is in effect.
If page footers are in use, any partial page will be extended to the full size before the footers are output.
This method does nothing if the stream is in control
mode.
ErrorConditionException
- On any error during I/O.public void flush()
control
mode.public void startOutput(int newColumn)
putField(int)
,
putSpace()
, putLineEnd()
and writeField(int)
methods.
When filled, the buffer must be written to the stream using
endOutput()
.
There must always be an intervening endOutput
between
every two calls to this method. Do not try to nest calls to this
method.
This method does nothing if the stream is in control
mode.
newColumn
- Initial value for column counter.public void endOutput() throws ErrorConditionException, StopConditionException
putField(int)
, putSpace()
,
putLineEnd()
and writeField(int)
methods to the stream.
This method also resets the current delimiter to the default.
This method does nothing if the stream is in control
mode.
ErrorConditionException
- On any error during I/O.StopConditionException
- If any interruption occurs during I/O processing.public void endOutput(boolean appendNewLine) throws ErrorConditionException, StopConditionException
putField(int)
, putSpace()
,
putLineEnd()
and writeField(int)
methods to the stream.
This method also resets the current delimiter to the default.
This method does nothing if the stream is in control
mode.
appendNewLine
- Automatically add new line at the end of output.ErrorConditionException
- On any error during I/O.StopConditionException
- If any interruption occurs during I/O processing.public void pulseOutput()
public void putLineEnd() throws ErrorConditionException
control
mode.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
This method is built to duplicate the behavior of the SKIP option with the put statement.
ErrorConditionException
- On any error during I/O.public void putLineEnd(int num) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
num
- The number of blank lines to follow the current line (which
means that this number of line-ends + 1 must be appended).
If this is negative, no output is generated. If 0, 1 line-end
is output if (and only if) the current output position is not
already at the beginning of the line. If 1, then 2 line-ends
are output and so on.ErrorConditionException
- On any error during I/O.public void putSpace() throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
ErrorConditionException
- On any error during I/O.public void putSpace(int num) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
num
- The number of spaces to append.ErrorConditionException
- On any error during I/O.public void putNull() throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
ErrorConditionException
- On any error during I/O.public void putNull(int num) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
num
- The number of nulls to append.ErrorConditionException
- On any error during I/O.public void putField(int val) throws ErrorConditionException
int
value to the output buffer with the default
format string of '->,>>>,>>9' at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.ErrorConditionException
- On any error during I/O.public void putField(int val, java.lang.String fmt) throws ErrorConditionException
int
value to the output buffer with the given
format string at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'->,>>>,>>9' will be used.ErrorConditionException
- On any error during I/O.public void putField(int val, boolean starts, int col) throws ErrorConditionException
int
value to the output buffer with the default
format string of '->,>>>,>>9' at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(int val, java.lang.String fmt, boolean starts, int col) throws ErrorConditionException
int
value to the output buffer with the given
format string at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'->,>>>,>>9' will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(int val, boolean starts, NumberType col) throws ErrorConditionException
int
value to the output buffer with the default
format string of '->,>>>,>>9' at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(int val, java.lang.String fmt, boolean starts, NumberType col) throws ErrorConditionException
int
value to the output buffer with the given
format string at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'->,>>>,>>9' will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(double val) throws ErrorConditionException
double
value to the output buffer with the
default format string of '->>,>>9.99' at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.ErrorConditionException
- On any error during I/O.public void putField(double val, java.lang.String fmt) throws ErrorConditionException
double
value to the output buffer with the
given format string at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'->>,>>9.99' will be used.ErrorConditionException
- On any error during I/O.public void putField(double val, boolean starts, int col) throws ErrorConditionException
double
value to the output buffer with the
default format string of '->>,>>9.99' at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(double val, java.lang.String fmt, boolean starts, int col) throws ErrorConditionException
double
value to the output buffer with the
given format string at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'->>,>>9.99' will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(double val, boolean starts, NumberType col) throws ErrorConditionException
double
value to the output buffer with the
default format string of '->>,>>9.99' at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(double val, java.lang.String fmt, boolean starts, NumberType col) throws ErrorConditionException
double
value to the output buffer with the
given format string at the current output column.
Note that this format string works as the display form, which pads on
the left to the full size of the format string. This is different from
the normal operation of toString
.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'->>,>>9.99' will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(boolean val) throws ErrorConditionException
boolean
value to the output buffer with the
default format string of 'yes/no' at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.ErrorConditionException
- On any error during I/O.public void putField(boolean val, java.lang.String fmt) throws ErrorConditionException
boolean
value to the output buffer with the
given format string at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'yes/no' will be used.ErrorConditionException
- On any error during I/O.public void putField(boolean val, boolean starts, int col) throws ErrorConditionException
boolean
value to the output buffer with the
default format string of 'yes/no' at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(boolean val, java.lang.String fmt, boolean starts, int col) throws ErrorConditionException
boolean
value to the output buffer with the
given format string at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'yes/no' will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(boolean val, boolean starts, NumberType col) throws ErrorConditionException
boolean
value to the output buffer with the
default format string of 'yes/no' at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(boolean val, java.lang.String fmt, boolean starts, NumberType col) throws ErrorConditionException
boolean
value to the output buffer with the
given format string at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'yes/no' will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(java.lang.String val) throws ErrorConditionException
String
value to the output buffer with a
format string of 'x(N)' (where N is the length of the value) at the
current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.ErrorConditionException
- On any error during I/O.public void putField(java.lang.String val, java.lang.String fmt) throws ErrorConditionException
String
value to the output buffer with the
given format string at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'x(N)' will be used (where N is the length of the value).ErrorConditionException
- On any error during I/O.public void putField(java.lang.String val, boolean starts, int col) throws ErrorConditionException
String
value to the output buffer with the
default format string of 'x(N)' will be used (where N is the length of
the value) at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(java.lang.String val, java.lang.String fmt, boolean starts, int col) throws ErrorConditionException
String
value to the output buffer with the
given format string at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'x(N)' will be used (where N is the length of the value) will
be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(java.lang.String val, boolean starts, NumberType col) throws ErrorConditionException
String
value to the output buffer with the
default format string of 'x(N)' will be used (where N is the length of
the value) at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(java.lang.String val, java.lang.String fmt, boolean starts, NumberType col) throws ErrorConditionException
String
value to the output buffer with the
given format string at the current output column.
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
'x(N)' will be used (where N is the length of the value) will
be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(BaseDataType val) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.ErrorConditionException
- On any error during I/O.public void putField(BaseDataType val, java.lang.String fmt) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
type-specific format will be used.ErrorConditionException
- On any error during I/O.public void putField(BaseDataType val, boolean starts, int col) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(BaseDataType val, boolean starts, NumberType col) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(BaseDataType val, java.lang.String fmt, boolean starts, NumberType col) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
type-specific format will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putField(BaseDataType val, java.lang.String fmt, boolean starts, int col) throws ErrorConditionException
Use of this method generates output to a buffer which must first be
initialized by startOutput(int)
. Once initialized, any number of
calls to this method (or related output methods) may be done and all
output will be gathered into the output buffer. To write this buffer
to the stream, call endOutput()
. Calls to this method must never
be done outside of a bracketed pair of matching startOutput
and endOutput
calls otherwise the results will be
undefined.
val
- The data to be output.fmt
- The format string to use. If null
, the default
type-specific format will be used.starts
- If true
, the output will be placed starting at
the given column (or on the next line at that column, if the
given column is already in use on the current line). If
false
, the output will be placed so that it
ends at the given column (or on the next line at that column,
if the calculated start column is already in use on the
current line).col
- The start or end column (which it is depends on the previous
parameter's value). This is used as a 1-based index into the
current output line.ErrorConditionException
- On any error during I/O.public void putControl(FieldEntry[] data) throws ErrorConditionException
data
- The list of fields to be output.ErrorConditionException
- On any error during I/O.public void putUnformatted(FieldEntry[] data) throws ErrorConditionException
data
- The list of fields to be output.ErrorConditionException
- On any error during I/O.public void put(FieldEntry[] data) throws ErrorConditionException
data
- The list of fields to be output.ErrorConditionException
- On any error during I/O.public void export(FieldEntry[] data) throws ErrorConditionException, StopConditionException
data
- The list of fields to be output.ErrorConditionException
- On any error during I/O.StopConditionException
- If any interruption occurs during I/O processing.public void writeControlled(java.lang.String txt)
flushControlled(boolean)
.txt
- The data to write. May be null
in which case
nothing is written to the buffer. If this is the empty
string, only a newline is written into the buffer.public void writeControlledSpecial(java.lang.String txt, int lines)
txt
- The data to write. The form feed is expected to be the first
character, followed by optional frame header lines, although
it is not checkedlines
- number of header lines in the passed text. required for
adjusting the line counterpublic int flushControlled(boolean bypass) throws java.io.IOException
writeControlled(java.lang.String)
) to
the stream. This method maintains all needed state for proper paging
processing and it will output report headers or footers as needed.bypass
- true
if header processing must be bypassed when
starting to flush the output.java.io.IOException
- if an I/O error occurs.public boolean needsHeadersOutput()
true
if header processing is not in process and
the stream has registered page headers and the next line
number is 1 (we have no output on the current page).public void processHeaders()
public void processHeadersUncond()
public void processHeadersInt()
public void processFooters()
public boolean hasPageHeadersFooters()
true
if this is a paged stream with at least
1 header or footer.public void registerPageBreakListener(PageBreakListener pl)
pl
- The object to receive a notification whenever a page break is
written to this stream.public void registerCloseListener(CloseListener cl)
cl
- The object to receive a notificationpublic void registerFlushListener(FlushListener fl)
fl
- The object to receive a notificationpublic void registerAdvanceListener(AdvanceListener al)
al
- The object to receive a notificationpublic void registerHeader(RepeatedOutput head)
head
- The header to add.public void registerFooter(RepeatedOutput foot)
foot
- The footer to add.public void deregisterHeader(RepeatedOutput head)
head
- The header to remove.public void deregisterFooter(RepeatedOutput foot)
foot
- The footer to remove.public int64 getPosition()
Starting with OpenEdge Release 10.1B, ABL includes a 64-bit integer data type. They
are mapped to the underlying Java platform that can handle streams with offsets that are
based on a 64-bit long
.
unknown value
if the
stream type doesn't support a stream position.public void setPosition(int64 newpos)
Starting with OpenEdge Release 10.1B, ABL includes a 64-bit integer data type. They
are mapped to the underlying Java platform that can handle streams with offsets that are
based on a 64-bit long
.
A negative offset is ignored (no action is taken).
If the specified offset is larger than the length of the stream, in Progress the seek position will report as the number requested, but if no subsequent writes occur to the file, the file size is left the same as it was before setting the position. If writes do occur, all writes occur at the new position. In this case, the resulting file will be sized based on the requested offset + the number of bytes written.
newpos
- The new offset. If this is the unknown value
,
the set operation will silently return without any change.public void setPosition(long newpos)
Starting with OpenEdge Release 10.1B, ABL includes a 64-bit integer data type. They
are mapped to the underlying Java platform that can handle streams with offsets that are
based on a 64-bit long
.
A negative offset is ignored (no action is taken).
If the specified offset is larger than the length of the stream, in Progress the seek position will report as the number requested, but if no subsequent writes occur to the file, the file size is left the same as it was before setting the position. If writes do occur, all writes occur at the new position. In this case, the resulting file will be sized based on the requested offset + the number of bytes written.
newpos
- The new offset. If this is the unknown value
,
the set operation will silently return without any change.public void setAppend()
public int64 getLength()
unknown value
if the underlying stream does not support this operation.public void finished()
finished
in interface Finalizable
public void deleted()
This is a no-op for streams.
deleted
in interface Finalizable
public void iterate()
TransactionManager
. This implementation does nothing.iterate
in interface Finalizable
public void retry()
TransactionManager
. This implementation does nothing.retry
in interface Finalizable
public static java.lang.String generateStringFormat(java.lang.String fmt, int len)
null
.fmt
- The format string (return unchanged if not null
)
of null
to trigger the generation of a default
string-length format.len
- Fixed string value length.public abstract long available() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public abstract long getPos() throws java.lang.UnsupportedOperationException, java.io.IOException
java.lang.UnsupportedOperationException
- If the requested operation is not supported.java.io.IOException
- If an I/O error occurs.public abstract void setPos(long pos) throws java.lang.UnsupportedOperationException, java.io.IOException
This does not work for "streams" that require sequential access.
pos
- The new read/write position in the stream.java.lang.UnsupportedOperationException
- If the requested operation is not supported.java.io.IOException
- If an I/O error occurs.public abstract long getLen() throws java.lang.UnsupportedOperationException, java.io.IOException
java.lang.UnsupportedOperationException
- If the requested operation is not supported.java.io.IOException
- If an I/O error occurs.public abstract void setLen(long len) throws java.lang.UnsupportedOperationException, java.io.IOException
len
- The new length of the file.java.lang.UnsupportedOperationException
- If the requested operation is not supported.java.io.IOException
- If an I/O error occurs.public abstract void writeCh(char ch) throws java.io.IOException
ch
- The character to be written.java.io.IOException
- If an I/O error occurs.public abstract void writeByte(byte b) throws java.io.IOException
b
- The byte to be written.java.io.IOException
- If an I/O error occurs.public abstract void write(java.lang.String data) throws java.io.IOException
data
- The data to be written.java.io.IOException
- If an I/O error occurs.public abstract void write(byte[] data) throws java.io.IOException
data
- The data to be written.java.io.IOException
- If an I/O error occurs.public abstract void write(byte[] data, int off, int len) throws java.io.IOException
data
- The data to be written.off
- Starting offset in data from which to read bytes to be written. Must be
non-negative and < data.length
.len
- Length of data to be written. Must be non-negative and <= (data.length
- offset)
.java.io.IOException
- If an I/O error occurs.public abstract int peekCh()
peekCh()
and readCh()
will return the same value).
The underlying stream subclass determines the content of the result. Byte oriented streams such as pipes or files will return a byte while streams that generate keystrokes or characters may return a DBCS or Unicode character.
EOF
.public abstract int readCh()
The underlying stream subclass determines the content of the result. Byte oriented streams such as pipes or files will return a byte while streams that generate keystrokes or characters may return a DBCS or Unicode character.
EOF
.public abstract java.lang.String readLn() throws java.io.EOFException, java.io.IOException, java.lang.InterruptedException
File.separator
or to the EOF
. Any line separator character(s) and the
EOF
character are not returned.java.io.IOException
- If an I/O error occurs.java.io.EOFException
- If this input stream reaches the end before reading all the bytes.java.lang.InterruptedException
- If any thread interrupted the current thread before or while
the current thread was waiting for a notification.public abstract void closeIn()
public abstract void closeOut()
public abstract void close()
public abstract boolean isIn()
true
if the input side of the stream is active.public abstract boolean isOut()
true
if the output side of the stream is active.public boolean isValid()
true
if the stream is valid.public boolean isSuppressFormFeed()
public abstract void assign(Stream stream) throws java.lang.UnsupportedOperationException
stream
- The new internal stream reference to use for all operations.java.lang.UnsupportedOperationException
- If the requested operation is not supported.public byte[] readChunk(int len) throws java.io.IOException
EOF
, whichever
comes first. The EOF
character is not returned.len
- The number of bytes to read.null
if there
is nothing to read (the EOF
has been reached). The
length of the returned array will be the smaller of the
len
parameter or the actual bytes left before the
EOF
.java.io.IOException
- If an I/O error occurs.public boolean isFreshPage()
The current column has to be zero indicating there is no pending PUT output.
true
if the page is fresh.public int getAvailableLines()
public int getEffectivePageSize()
public void forcePageBreak()
This method should be called only when the caller guarantees at least one character will be output to the new page. Otherwise the last headers will be there without reason.
public void forcePageBreak(boolean headers)
headers
- true
to force the headers on the next page to
be output before returning.public void setContiguous(boolean contiguous)
true
no
automatic page break will be generated when output reached the end of
the page size.
At the end of flushing, the flags will be reset.
contiguous
- true
to enable contiguous mode.public boolean isContiguous()
true
is the stream has contiguous mode enabled.public void setFont(NumberType num)
num
- Font number.public void setFont(int num)
num
- Font number.public boolean getPulseOnClose()
true
if need to call pulse on stream closing.public void setPulseOnClose(boolean pulseOnClose)
pulseOnClose
- New value for pulse on close flag.boolean needsPageBreak()
true
if a page break should be output.boolean needsPageBreak(int add)
add
- The number of lines of output that are about to be added. If
this value would cause a page to be overflowed, then a page
break will be detected. May be 0 in the case where this is
called after output is complete.true
if a page break should be output.int rawGetPageSize()
void rawSetPageSize(int sz)
sz
- The number of lines per page.int rawGetPageNum()
void rawIncrementPageNum()
int rawGetNextLineNum()
void rawIncrementNextLineNum()
void rawResetNextLineNum()
protected final void afterWrite() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.protected void flushData() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.protected void cleanup(boolean in, boolean out) throws java.io.IOException
close()
method. This allows processing to occur while the stream is still
open.in
- true
if this was triggered during a call to
closeIn()
or close()
. Input resources are
to be cleaned up.out
- true
if this was triggered during a call to
closeOut()
or close()
. Output resources are
to be cleaned up.java.io.IOException
protected java.lang.String readLineCleanup(java.lang.StringBuilder sb) throws java.io.EOFException
sb
- Buffered text, possibly ended by a new line.java.io.EOFException
protected int indexOfNewLine(java.lang.StringBuilder sb)
sb
- Buffered text to find the new line separator string.protected boolean skipLoneHyphenInput()
true
.public void putWorker(FieldEntry[] data, int mode, char delim) throws ErrorConditionException
data
- The list of fields to be output.mode
- MODE_PUT_NORMAL
, MODE_PUT_CONTROL
,
MODE_PUT_UNFORMATTED
or MODE_EXPORT
.delim
- The delimiter to use in EXPORT mode.ErrorConditionException
- On any error during I/O.public boolean isTerm()
true
if stream is terminal.public int getPendingRowCount()
public void setPendingRowCount(int rows)
rows
- Number of pending rows.private void extendPage() throws java.io.IOException
java.io.IOException
private java.lang.String reload(boolean inString) throws EndConditionException, ErrorConditionException, StopConditionException
inString
- true
if the special EOF processing (when the '.'
appears by itself on its own line) should NOT be honored.
This only occurs during formatted reading when a string is
being processed.null
in the case of
and error condition raised during silent error mode.EndConditionException
- Upon reading at EOF (not up to EOF but the read that occurs
where EOF is the next character to be read).ErrorConditionException
- If an IOException occurs.StopConditionException
- If the read was interrupted.private java.lang.String readNextLine(boolean inString) throws java.io.EOFException, java.io.IOException, java.lang.InterruptedException
EOF
event (as reported by the stream),
the EOF
character (0x1A or CTRL-Z), the fake Progress
EOF
character (a "." by itself on its own line) and the
line continuation characters of tilde and backslash.
If the null
character is detected in the read data, all
data from that character through the next newline
(inclusive) will be discarded. This is effectively, another form of
line continuation as the next line will be seamlessly concatenated to
this result. The only exception to this is when there is no following
newline
on the NEXT line in which case ALL data read is
discarded and the empty string is returned (WARNING: the EOF event is
not raised until the next call to this method in this case).
inString
- true
if the special EOF processing (when the '.'
appears by itself on its own line) should NOT be honored.
This only occurs during formatted reading when a string is
being processed.java.io.EOFException
java.io.IOException
java.lang.InterruptedException
private java.lang.String readLineDropNull() throws java.io.EOFException, java.io.IOException, java.lang.InterruptedException
null
character including the next newline
.
This is effectively, another form of line continuation as the next line
will be seamlessly concatenated to this result.
The only exception to this is when there is no following
newline
on the NEXT line in which case ALL data read is
discarded and the empty string is returned (WARNING: the EOF event is
not raised until the next call to this method in this case). Note that
in this case an internal flag is set which can be checked in the
caller.
java.io.EOFException
java.io.IOException
java.lang.InterruptedException
private void processLineEnd(boolean conditional, boolean noPageBreak) throws ErrorConditionException
If in control mode, no page breaks will be emitted and the page/line counters will not be modified.
If conditional
parameter is set to true
then
new line is appended only if buffer does contain new line at the end.
conditional
- If this parameter is set to true
then appending
of new line is conditional.noPageBreak
- If this parameter is set to true
then there is no
checking for page break. Instead, the line-counter is
incremented.ErrorConditionException
private void writeNewLine() throws ErrorConditionException
ErrorConditionException
private void setTrailingNL(boolean trailingNL)
trailingNL
- Track trailing NEWLINE state.private void processPageBreak()
If in control mode, no page breaks will be emitted and the page/line counters will not be modified (this is a NOP).
private void writePageBreak() throws ErrorConditionException
ErrorConditionException
private void processPageBreakNotifications()
private void processCloseNotifications()
private void processUnbindNotifications()
private void processAdvanceNotifications()
private void processRendering(java.util.Set<RepeatedOutput> out, boolean footers)
RepeatedOutput
instances and
for each element, invoke the RepeatedOutput.render(com.goldencode.p2j.util.Stream)
method.out
- The list of instances to use for rendering.footers
- When set to true
, it means we output the page
footers; else, we output the headers.private void append(java.lang.String data) throws ErrorConditionException, StopConditionException
control
mode, the output buffer is
bypassed (the output is written directly to the stream) and no updates
are made to the line/page counters.data
- The string to append.ErrorConditionException
StopConditionException
private void append(char data) throws ErrorConditionException, StopConditionException
char
to the output buffer and maintain
the column counter. If in control
mode, the output buffer is
bypassed (the output is written directly to the stream) and no updates
are made to the line/page counters.data
- The char
to append.ErrorConditionException
StopConditionException
private java.lang.String generateFormattedText(BaseDataType val, java.lang.String fmt)
Formatting rules are specified in the table below, but please read comments to the table first:
put (with or without format string) / put unformatted with format string specification | put unformatted without format string specification / put control | |
integer, not unknown | specific format, right-aligned up to format length | string format |
decimal, not unknown | specific format, right-aligned up to format length | string format |
character, not unknown | specific format | string format |
date, not unknown | specific format | string format |
logical, not unknown | specific format, left-aligned up to maximum between positive value length and negative value length | string format |
recid, not unknown | specific format, right-aligned up to format length | string format |
unknown integer | ?, right-aligned up to specific format length | ? |
unknown decimal | ?, right-aligned up to specific format length | ? |
unknown character | ?, left-aligned up to specific format length | ? |
unknown date | string consisting of spaces which number equals specific format length | ? |
unknown logical | ?, left-aligned up to maximum between positive value length and negative value length in the specific format | ? |
unknown recid | ?, right-aligned up to specific format length | ? |
unknown literal | if explicit format string is specified, then it is ?, left-aligned up to explicit format length, otherwise it is ? followed by three spaces | ? |
val
- The data to be output.fmt
- The format string to use. If null
, the default
type-specific format will be used.private void checkForPageBreak()
LINE-COUNTER ≥ PAGE-SIZE + 1