public abstract class AbstractSarWriter extends OutputStreamWriter implements ISarWriter
Modifier and Type | Field and Description |
---|---|
protected String |
indent |
protected String |
nullRepresentation |
protected Stack<no.esito.anonymizer.core.AbstractSarWriter.Table> |
stack |
Constructor and Description |
---|
AbstractSarWriter(OutputStream out)
See OutputStream.
|
AbstractSarWriter(OutputStream out,
Charset cs)
See OutputStream.
|
AbstractSarWriter(OutputStream out,
CharsetEncoder enc)
See OutputStream.
|
AbstractSarWriter(OutputStream out,
String charsetName)
See OutputStream.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clear() |
void |
close() |
String |
escape(char c)
Escape algorithm per character.
|
String |
escape(String string)
Escape string.
|
static String |
escapeJson(char c) |
static String |
escapeXml(char c) |
void |
flush() |
String |
id(String name)
Process illegal characters for ID.
|
String |
indentBlock(String inner,
String indent)
Indent a block of text.
|
protected void |
init(String indent,
String nullRepresetation)
Indent should be for each level of tables.
|
void |
pop()
Return up one level.
|
void |
push(String table,
String label,
String comment)
Recurse tables deeper.
|
void |
setIndentation(String indent)
Set indentation type.
|
void |
setNullRepresentation(String nullRepresentation)
Set DBMS NULL Representation.
|
String |
toString() |
String |
wrapColumns(List<String> list)
Wrap columns.
|
String |
wrapInner(List<String> list)
Wrap children elements.
|
String |
wrapTables(String table,
List<String> list)
Wrap tables.
|
void |
write(String colname,
String label,
String comment,
String value)
Output attribute.
|
getEncoding, write, write, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
writeColumn, writeRoot, writeTable
protected Stack<no.esito.anonymizer.core.AbstractSarWriter.Table> stack
protected String indent
protected String nullRepresentation
public AbstractSarWriter(OutputStream out, Charset cs)
out
- OutputStreamcs
- Charsetpublic AbstractSarWriter(OutputStream out, CharsetEncoder enc)
out
- OutputStreamenc
- CharsetEncoderpublic AbstractSarWriter(OutputStream out, String charsetName) throws UnsupportedEncodingException
out
- OutputStreamcharsetName
- StringUnsupportedEncodingException
- exceptionpublic AbstractSarWriter(OutputStream out)
out
- OutputStreamprotected void init(String indent, String nullRepresetation)
indent
- stringnullRepresetation
- stringprotected void clear()
public void setNullRepresentation(String nullRepresentation)
ISarWriter
setNullRepresentation
in interface ISarWriter
nullRepresentation
- used to represent the DBMS null value in the output If value is null the actual column is omitted
from the outputpublic void setIndentation(String indent)
ISarWriter
setIndentation
in interface ISarWriter
indent
- Stringpublic void push(String table, String label, String comment)
ISarWriter
push
in interface ISarWriter
table
- table namelabel
- optional labelcomment
- optional commentpublic void pop()
ISarWriter
pop
in interface ISarWriter
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStreamWriter
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStreamWriter
IOException
public String wrapTables(String table, List<String> list)
ISarWriter
wrapTables
in interface ISarWriter
table
- common table namelist
- rows for the tablepublic String wrapColumns(List<String> list)
ISarWriter
wrapColumns
in interface ISarWriter
list
- as listpublic String wrapInner(List<String> list)
ISarWriter
wrapInner
in interface ISarWriter
list
- elementspublic String indentBlock(String inner, String indent)
ISarWriter
indentBlock
in interface ISarWriter
inner
- block of textindent
- as spacespublic void write(String colname, String label, String comment, String value)
ISarWriter
write
in interface ISarWriter
colname
- column namelabel
- optional labelcomment
- optional commentvalue
- value to writepublic String escape(String string)
ISarWriter
escape
in interface ISarWriter
string
- to escapepublic String id(String name)
ISarWriter
id
in interface ISarWriter
name
- inputpublic String escape(char c)
ISarWriter
escape
in interface ISarWriter
c
- charpublic static String escapeJson(char c)
public static String escapeXml(char c)
Copyright © 2021. All rights reserved.