Top Inners Fields Constructors Methods
org.apache.poi.util

public Class GenericRecordXmlWriter

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Annotations
@SuppressWarnings:WeakerAccess
Imports
java.awt.Color, java.awt.geom.AffineTransform, .Dimension2D, .Path2D, .PathIterator, .Point2D, .Rectangle2D, java.awt.image.BufferedImage, java.io.Closeable, .File, .IOException, .OutputStream, .OutputStreamWriter, .PrintWriter, java.lang.reflect.Array, java.nio.charset.StandardCharsets, java.nio.file.Files, java.util.AbstractMap, .ArrayList, .Arrays, .Base64, .List, .Map, java.util.function.Supplier, java.util.regex.Matcher, .Pattern, java.util.stream.Collectors, .Stream, org.apache.commons.io.output.NullOutputStream, org.apache.poi.common.usermodel.GenericRecord, org.apache.poi.util.GenericRecordJsonWriter.AppendableWriter

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface

Field Summary

Modifier and TypeField and Description
private boolean
private int
private static final Pattern
private final PrintWriter
private static final List<Map.Entry<Class<?>, GenericRecordXmlWriter.GenericRecordHandler>>
private int
private static final String
private boolean
private static final String

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

protected void
private static void
protected static boolean
public static String
public static String
marshal(GenericRecord record, boolean withComments)

protected static boolean
matchInstanceOrArray(Class<?> key, Object instance)

protected void
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected void
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
public void
setWithComments(boolean withComments)

protected String
tabs()

protected String
trimHex(final long l, final int size)

public void
protected void
write(final String name, GenericRecord record)

protected boolean
writeChildren(GenericRecord record, boolean hasComplexProperties)

public void
writeError(String errorMsg)

protected Stream<Map.Entry<String, Supplier<?>>>
protected boolean
protected void
writeValue(String name, Object value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributePhaseback to summary
private boolean attributePhase
childIndexback to summary
private int childIndex
ESC_CHARSback to summary
private static final Pattern ESC_CHARS
fwback to summary
private final PrintWriter fw
handlerback to summary
private static final List<Map.Entry<Class<?>, GenericRecordXmlWriter.GenericRecordHandler>> handler
indentback to summary
private int indent
TABSback to summary
private static final String TABS
withCommentsback to summary
private boolean withComments
ZEROSback to summary
private static final String ZEROS

Constructor Detail

GenericRecordXmlWriterback to summary
public GenericRecordXmlWriter(File fileName) throws IOException
GenericRecordXmlWriterback to summary
public GenericRecordXmlWriter(Appendable buffer)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
closeNameback to summary
protected void closeName(String name)
handlerback to summary
private static void handler(Class<?> c, GenericRecordXmlWriter.GenericRecordHandler printer)
isComplexback to summary
protected static boolean isComplex(Object obj)
marshalback to summary
public static String marshal(GenericRecord record)
marshalback to summary
public static String marshal(GenericRecord record, boolean withComments)
matchInstanceOrArrayback to summary
protected static boolean matchInstanceOrArray(Class<?> key, Object instance)
openNameback to summary
protected void openName(String name)
printAffineTransformback to summary
protected boolean printAffineTransform(String name, Object o)
printAnnotatedFlagback to summary
protected boolean printAnnotatedFlag(String name, Object o)
printArrayback to summary
protected boolean printArray(String name, Object o)
printBooleanback to summary
protected boolean printBoolean(String name, Object o)
printBufferedImageback to summary
protected boolean printBufferedImage(String name, Object o)
printBytesback to summary
protected boolean printBytes(String name, Object o)
printColorback to summary
protected boolean printColor(String name, Object o)
printDimensionback to summary
protected boolean printDimension(String name, Object o)
printGenericRecordback to summary
protected void printGenericRecord(String name, Object value)
printListback to summary
protected boolean printList(String name, Object o)
printNumberback to summary
protected boolean printNumber(String name, Object o)
printObjectback to summary
protected boolean printObject(String name, Object o)
printPathback to summary
protected boolean printPath(String name, Object o)
printPointback to summary
protected boolean printPoint(String name, Object o)
printRectangleback to summary
protected boolean printRectangle(String name, Object o)
setWithCommentsback to summary
public void setWithComments(boolean withComments)
tabsback to summary
protected String tabs()
trimHexback to summary
protected String trimHex(final long l, final int size)
writeback to summary
public void write(GenericRecord record)
writeback to summary
protected void write(final String name, GenericRecord record)
writeChildrenback to summary
protected boolean writeChildren(GenericRecord record, boolean hasComplexProperties)
writeErrorback to summary
public void writeError(String errorMsg)
writePropback to summary
protected Stream<Map.Entry<String, Supplier<?>>> writeProp(Map.Entry<String, Supplier<?>> me)
Annotations
@SuppressWarnings:java:S1452
writePropertiesback to summary
protected boolean writeProperties(GenericRecord record)
writeValueback to summary
protected void writeValue(String name, Object value)
org.apache.poi.util back to summary

protected Interface GenericRecordXmlWriter.GenericRecordHandler

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true, if the element was handled and output produced, The provided methods can be overridden and an implementation can return false, if the element hasn't been written to the stream
print
(GenericRecordXmlWriter
the parent record, applied via instance method reference
record
,
String
the name of the property
name
,
Object
the value of the property
object
)

Handler method

Method Detail

printback to summary
public boolean print(GenericRecordXmlWriter record, String name, Object object)

Handler method

Parameters
record:GenericRecordXmlWriter

the parent record, applied via instance method reference

name:String

the name of the property

object:Object

the value of the property

Returns:boolean

true, if the element was handled and output produced, The provided methods can be overridden and an implementation can return false, if the element hasn't been written to the stream