public class DMRPrinter
extends java.lang.Object
WARNING: the printDMR code in some cases duplicates code in dap4.dap4.Dap4Print; so changes here should be propagated.
Modifier and Type | Class and Description |
---|---|
static class |
DMRPrinter.Controls |
Modifier and Type | Field and Description |
---|---|
static boolean |
ALLOWFIELDMAPS |
protected CEConstraint |
ce |
protected java.util.EnumSet<DMRPrinter.Controls> |
controls |
protected DapContext |
cxt |
protected DapDataset |
dmr |
protected ResponseFormat |
format |
protected static java.lang.String[] |
GROUPSPECIAL |
protected java.util.Map<DapVariable,java.lang.Long> |
localchecksummap |
protected static int |
NILFLAGS |
protected static int |
NONAME |
protected static int |
NONNIL |
protected java.nio.ByteOrder |
order |
protected static int |
PERLINE |
protected IndentWriter |
printer |
protected static java.lang.String[] |
RESERVEDTAGS |
protected static java.lang.String[] |
VARSPECIAL |
protected java.io.PrintWriter |
writer |
static java.lang.String |
XMLDOCUMENTHEADER |
protected static int |
XMLESCAPED |
Modifier | Constructor and Description |
---|---|
protected |
DMRPrinter() |
|
DMRPrinter(DapDataset dmr,
CEConstraint ce,
java.io.PrintWriter writer,
ResponseFormat format) |
|
DMRPrinter(DapDataset dmr,
CEConstraint ce,
java.io.PrintWriter writer,
ResponseFormat format,
DapContext cxt) |
|
DMRPrinter(DapDataset dmr,
java.io.PrintWriter writer) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
static java.lang.String |
fqnXMLEscape(java.lang.String fqn)
XML escape a dap fqn
and converting '"' to "
Assumes backslash escapes are in effect for '/' and '.'
|
protected static java.lang.String |
getPrintValue(java.lang.Object value) |
protected boolean |
hasDimensions(DapVariable var) |
protected boolean |
hasMaps(DapVariable var) |
protected boolean |
hasMetadata(DapNode node) |
protected boolean |
hasRequestData(DapVariable var) |
void |
print()
Print a DapDataset:
- as DMR
- optionally constrained
|
static void |
print(DapDataset dmr,
java.io.PrintStream stream) |
static java.lang.String |
printAsString(DapDataset dmr) |
protected void |
printContainerAttribute(DapAttribute attr) |
protected void |
printMetadata(DapNode node) |
boolean |
printNode(DapNode node)
Print an arbitrary DapNode and its subnodes
as if it is being sent to a client with
optional constraint; inclusions are determined
by the view.
|
protected void |
printOtherXML(DapAttribute attr) |
protected void |
printRequestData(DapVariable var)
Print request-specific per-variable data
Like printRequestMetaData, this is nasty hack
to avoid modifying the DMR.
|
protected void |
printReserved(DapNode node) |
protected void |
printXMLAttribute(java.lang.String name,
java.lang.String value,
int flags)
PrintXMLAttributes helper function
|
void |
setControl(DMRPrinter.Controls ctl) |
protected static final int NILFLAGS
protected static final int PERLINE
protected static final int NONAME
protected static final int NONNIL
protected static final int XMLESCAPED
protected static final java.lang.String[] GROUPSPECIAL
protected static final java.lang.String[] VARSPECIAL
protected static final java.lang.String[] RESERVEDTAGS
public static final boolean ALLOWFIELDMAPS
public static final java.lang.String XMLDOCUMENTHEADER
protected java.io.PrintWriter writer
protected IndentWriter printer
protected DapDataset dmr
protected CEConstraint ce
protected ResponseFormat format
protected DapContext cxt
protected java.nio.ByteOrder order
protected java.util.Map<DapVariable,java.lang.Long> localchecksummap
protected java.util.EnumSet<DMRPrinter.Controls> controls
protected DMRPrinter()
public DMRPrinter(DapDataset dmr, java.io.PrintWriter writer)
public DMRPrinter(DapDataset dmr, CEConstraint ce, java.io.PrintWriter writer, ResponseFormat format)
public DMRPrinter(DapDataset dmr, CEConstraint ce, java.io.PrintWriter writer, ResponseFormat format, DapContext cxt)
public static void print(DapDataset dmr, java.io.PrintStream stream)
public static java.lang.String printAsString(DapDataset dmr)
public void flush()
public void close()
public void setControl(DMRPrinter.Controls ctl)
public void print() throws java.io.IOException
java.io.IOException
public boolean printNode(DapNode node) throws java.io.IOException
Handling newlines is a bit tricky because they may be embedded for e.g. groups, enums, etc. So the rule is that the last newline is elided and left for the caller to print. Exceptions: printMetadata printDimrefs, printMaps
node
- - the node to printjava.io.IOException
- Note that the PrintWriter is global.protected void printXMLAttribute(java.lang.String name, java.lang.String value, int flags) throws DapException
name
- value
- flags
- DapException
protected void printReserved(DapNode node) throws DapException
DapException
protected void printMetadata(DapNode node) throws java.io.IOException
java.io.IOException
protected void printContainerAttribute(DapAttribute attr)
protected void printOtherXML(DapAttribute attr)
protected void printRequestData(DapVariable var) throws DapException
var
- DapException
public static java.lang.String fqnXMLEscape(java.lang.String fqn)
fqn
- the backslash escaped fqnprotected static java.lang.String getPrintValue(java.lang.Object value)
protected boolean hasMetadata(DapNode node)
protected boolean hasMaps(DapVariable var)
protected boolean hasDimensions(DapVariable var)
protected boolean hasRequestData(DapVariable var)