public class PLIStream extends java.lang.Object implements IPLIFile
IPLIFile.Attr
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
size in bytes if converted to a byte array
hint: cannot be converted to a byte array
|
Constructor and Description |
---|
PLIStream()
Construct a PLIStream with no attributes
|
PLIStream(IPLIFile dclFile,
java.lang.String title,
java.lang.String env,
int lineSize,
int pageSize)
construct a PLIStream from an IPIFile used to declare the PL/I FILE variable,
and then overridden with non-null other attributes.
|
PLIStream(java.lang.String ddName,
java.util.EnumSet<IPLIFile.Attr> declareFileAttributes)
Construct a PLIStream of a certain FILE name and attributes
|
PLIStream(java.lang.String ddName,
java.util.EnumSet<IPLIFile.Attr> declareFileAttributes,
java.lang.String title,
java.lang.String environment,
int lineSize,
int pageSize)
Construct a PLIStream with a certain FILE name, attributes and
TITLE, ENVIRONMENT, LINESIZE and PAGESIZE options from the
DCL . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file
|
boolean |
delete()
Delete the current record (the last record read) NOT VALID for STREAM files
|
boolean |
delete(byte[] key)
Delete the record identified by the key specified NOT VALID for STREAM files
|
boolean |
deleteByPrimary(byte[] key)
Delete the record identified by the primary /relative record key NOT VALID for STREAM files
|
boolean |
deleteFile()
Deletes the file
|
void |
endData()
Finish the GET DATA operation ..
|
java.lang.Object |
getData(java.lang.String name,
java.lang.Object intoVar)
Perform a GET DATA operation (name=value variable retrieval) from an input stream
|
java.lang.String |
getDDName()
Return the DD name for this FILE, which is either the FILE variable or constant name
or an alternate to it specific with the TITLE attribute
|
java.util.EnumSet<IPLIFile.Attr> |
getDeclareFileAttributes()
Return the the set of file attributes used on the DCL
|
java.lang.String |
getDSName()
Return the dataset name for this FILE which has been passed as part of the TITLE
attribute or associated with the system property or environment variable associated with its DD name.
|
java.lang.String |
getEnvironment()
Return the current environment for the declared file
|
java.lang.String |
getNextString(boolean quoted)
Return the next string from the Scanner input stream
|
java.util.EnumSet<IPLIFile.Attr> |
getOpenFileAttributes()
Return the the set of file attributes used on the OPEN FILE
|
java.lang.String |
getTitle()
Return the current title for the declared file
|
java.io.InputStream |
inputStream()
Return the Java InputStream associated with this PLI FILE
|
boolean |
is(IPLIFile.Attr attr1)
Help determine if a file attribute is set
|
boolean |
isIsnt(IPLIFile.Attr attr1,
IPLIFile.Attr attr2)
Help determine if one of two mutually exclusive alternatives is
or isn't set by checking (first) the open and then (second) declare attributes
|
boolean |
isOpen()
indicate whether the file is open
|
boolean |
isStream()
For PLIStream FILEs this always returns true
|
byte[] |
keyto()
Return the last key read as a result of a locate(), read() or readPrev()
|
static java.lang.String |
Lines(int number)
Return a String with a number of Java String.format() formatted new-line escapes (%n)
|
boolean |
locate(byte[] key)
Locate a point within a keyed file NOT VALID for STREAM files
|
boolean |
open(java.util.EnumSet<IPLIFile.Attr> mode,
java.lang.String title,
java.lang.String environment,
int lineSize,
int pageSize)
Opens the file for read, write, both, append
|
java.io.OutputStream |
outputStream()
Return the Java OutputStream associated with this PLI FILE
|
java.io.PrintStream |
printStream()
Return the Java PrintStream associated with this PLI FILE
|
byte[] |
read()
Read the next record NOT VALID for STREAM files
|
byte[] |
read(byte[] key)
Read a single record with a key NOT VALID for STREAM files
|
byte[] |
readPrev()
Read the previous record NOT VALID for STREAM files
|
boolean |
rewrite(byte[] record)
Rewrite the current record with the data and embedded key NOT VALID for STREAM files
|
boolean |
rewrite(byte[] record,
byte[] key)
Rewrite the record given by a key with the data and embedded key NOT VALID for STREAM files
|
java.util.Scanner |
scanner()
Return the Java Scanner associated with the InputStream of this PLI FILE
|
static java.lang.String |
Spaces(int number)
Return a String with a number of spaces
|
java.lang.String |
toString()
Returns the self-defining information for the debugger
|
boolean |
write(byte[] record)
Write the file with the record NOT VALID for STREAM files
|
boolean |
write(byte[] record,
byte[] externalKey)
Write the file with the record NOT VALID for STREAM files
|
boolean |
write(byte[] record,
long rrn)
Write the file with the record NOT VALID for STREAM files
|
public static final int BYTES
public PLIStream()
public PLIStream(java.lang.String ddName, java.util.EnumSet<IPLIFile.Attr> declareFileAttributes)
ddName
- - the FILE constant or variable name, or its DD name replacementdeclareFileAttributes
- - the declareFileAttributes
to initializepublic PLIStream(java.lang.String ddName, java.util.EnumSet<IPLIFile.Attr> declareFileAttributes, java.lang.String title, java.lang.String environment, int lineSize, int pageSize)
DCL
.ddName
- - the FILE constant or variable name, or its DD name replacementdeclareFileAttributes
- - the declareFileAttributes
to initializetitle
- - the FILE TITLE optionenvironment
- - the FILE ENV optionlineSize
- - the FILE LINESIZE optionpageSize
- - the FILE PAGESIZE optionpublic PLIStream(IPLIFile dclFile, java.lang.String title, java.lang.String env, int lineSize, int pageSize)
dclFile
- - the IPIFile used during the declaration that is used
as a basis for constructing a PLIStream with the following overrides:title
- - the FILE TITLE optionenv
- - the FILE ENV optionlineSize
- - the FILE LINESIZE optionpageSize
- - the FILE PAGESIZE optionpublic static java.lang.String Spaces(int number)
number
- of spaces to returnpublic static java.lang.String Lines(int number)
number
- of "%n"'s to returnpublic boolean is(IPLIFile.Attr attr1)
attr1
- - an attribute to check to see if it is set (cannot be null)public boolean isIsnt(IPLIFile.Attr attr1, IPLIFile.Attr attr2)
attr1
- - an attribute to check to see if it is set (cannot be null)attr2
- - an attribute to check to see if it isn't set (cannot be null)public boolean isStream()
public java.lang.String toString()
toString
in class java.lang.Object
public java.io.PrintStream printStream()
printStream
in interface IPLIFile
{@link
- Condition#CONDITION} UNDEFINEDFILE} for files not opened, or cannot be converted,
to PRINT STREAMpublic java.io.InputStream inputStream()
inputStream
in interface IPLIFile
{@link
- Condition#CONDITION} UNDEFINEDFILE} for files not opened, or cannot be converted,
to INPUT STREAMpublic java.io.OutputStream outputStream()
outputStream
in interface IPLIFile
{@link
- Condition#CONDITION} UNDEFINEDFILE} for files not opened, or cannot be converted,
to PRINT STREAMpublic java.util.Scanner scanner()
public java.lang.String getNextString(boolean quoted)
quoted
- - if the string to be returned will be quotedpublic java.lang.Object getData(java.lang.String name, java.lang.Object intoVar)
getData
in interface IPLIFile
name
- - the name or partial name (i.e., part of a Group structure)intoVar
- - the variable to retrieve data into (Array, Group, Integer, etc.)public void endData()
public java.lang.String getDDName()
public java.lang.String getEnvironment()
getEnvironment
in interface IPLIFile
public java.lang.String getTitle()
public java.lang.String getDSName()
public java.util.EnumSet<IPLIFile.Attr> getDeclareFileAttributes()
getDeclareFileAttributes
in interface IPLIFile
public java.util.EnumSet<IPLIFile.Attr> getOpenFileAttributes()
getOpenFileAttributes
in interface IPLIFile
public boolean open(java.util.EnumSet<IPLIFile.Attr> mode, java.lang.String title, java.lang.String environment, int lineSize, int pageSize)
open
in interface IPLIFile
mode
- an EnumSet of Attrstitle
- - the TITLE attribute or nullenvironment
- - the ENVIRONMENT attribute or nulllineSize
- - the LINESIZE attribute or 0pageSize
- - the PAGESIZE attribute or 0
read sequential disregarding key order; null to read sequentially in orderbykey()
key orderpublic boolean isOpen()
public boolean deleteFile()
deleteFile
in interface IPLIFile
Condition.CONDITION.UNDEFINEDFILE
- if the file could not be
deletedpublic boolean locate(byte[] key)
public byte[] keyto()
public byte[] read(byte[] key)
public byte[] read()
public byte[] readPrev()
public boolean write(byte[] record, long rrn)
public boolean write(byte[] record)
public boolean write(byte[] record, byte[] externalKey)
public boolean rewrite(byte[] record)
public boolean rewrite(byte[] record, byte[] key)
public boolean deleteByPrimary(byte[] key)
deleteByPrimary
in interface IPLIFile
key
- the key of the record to deleteCondition.CONDITION.UNDEFINEDFILE
- unconditionallypublic boolean delete(byte[] key)