Interface IonDatagram
- All Superinterfaces:
Cloneable,Collection<IonValue>,IonContainer,IonSequence,IonValue,Iterable<IonValue>,List<IonValue>,SequencedCollection<IonValue>
- All Known Subinterfaces:
_Private_IonDatagram
WARNING: This interface should not be implemented or extended by code outside of this library. Some inherited methods are not yet implemented or are unsupported for datagrams.
Along with the normal user values, datagrams contain system values, notably
the symbol table(s) used to atomize all symbols. Most uses of a datagram
will not see system values,
but applications that need visibility into that data can use the
system*() methods.
-
Field Summary
Fields inherited from interface com.amazon.ion.IonValue
EMPTY_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionadd(int index) This inherited method is not yet supported by datagrams.voidThis inherited method is not yet supported by datagrams.booleanaddAll(int index, Collection<? extends IonValue> c) This inherited method is not yet supported by datagrams.voidaddTypeAnnotation(String annotation) This inherited method is not supported by datagrams.intbyteSize()Gets the number of bytes used to encode this datagram.clone()Creates a copy of this value and all of its children.get(int index) Gets a selected non-system element from this datagram.byte[]getBytes()Copies the binary-encoded form of this datagram into a new byte array.intgetBytes(byte[] dst) Deprecated.intgetBytes(byte[] dst, int offset) Deprecated.intgetBytes(OutputStream out) Copies the binary-encoded form of this datagram to a specified stream.Gets the container of this value, ornullif this is not part of one.This inherited method is not supported by datagrams because there's no single symbol table used across the contents.booleanReturnsfalseat every call, since datagrams cannot be null.iterator()Creates an iterator providing the (direct) elements of this datagram.voidmakeNull()This inherited method is not supported by datagrams.This inherited method is not yet supported by datagrams.intsize()Gets the number of elements in the datagram, not counting system elements.systemGet(int index) Gets a selected element from this datagram, potentially getting a hidden system element (such as a symbol table).Iterate all values in the datagram, including the otherwise-hidden system values such as version markers and symbol tables.intGets the number of elements in the datagram, including system elements such as version markers and symbol tables.byte[]toBytes()Deprecated.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.amazon.ion.IonContainer
clear, isEmpty, removeMethods inherited from interface com.amazon.ion.IonSequence
add, add, addAll, contains, containsAll, extract, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, subList, toArray, toArrayMethods inherited from interface com.amazon.ion.IonValue
accept, clearTypeAnnotations, equals, getFieldId, getFieldName, getFieldNameSymbol, getSystem, getType, getTypeAnnotations, getTypeAnnotationSymbols, hashCode, hasTypeAnnotation, isReadOnly, makeReadOnly, removeFromContainer, removeTypeAnnotation, setTypeAnnotations, setTypeAnnotationSymbols, topLevelValue, toPrettyString, toString, toString, writeToMethods inherited from interface java.util.List
addFirst, addLast, clear, equals, getFirst, getLast, hashCode, isEmpty, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Method Details
-
add
This inherited method is not yet supported by datagrams.Vote for issue amazon-ion/ion-java/issues/48 if you need this.
- Specified by:
addin interfaceIonSequence- Specified by:
addin interfaceList<IonValue>- Parameters:
element- is the element to be appended to this sequence.- Throws:
UnsupportedOperationException- at every call.ContainedValueException- ifchildis already part of a container.NullPointerException- ifchildisnull.- See Also:
-
add
This inherited method is not yet supported by datagrams.Vote for issue amazon-ion/ion-java/issues/48 if you need this.
- Specified by:
addin interfaceIonSequence- Throws:
UnsupportedOperationException- at every call.ContainedValueExceptionNullPointerException- See Also:
-
addAll
This inherited method is not yet supported by datagrams.Vote for issue amazon-ion/ion-java/issues/47 if you need this.
- Specified by:
addAllin interfaceIonSequence- Specified by:
addAllin interfaceList<IonValue>- Parameters:
index- index at which to insert first element from the specified collection.c- elements to be inserted into this sequence.- Returns:
trueif this sequence changed as a result of the call.- Throws:
UnsupportedOperationException- at every call.- See Also:
-
set
This inherited method is not yet supported by datagrams.Vote for issue amazon-ion/ion-java/issues/50 if you need this.
- Specified by:
setin interfaceIonSequence- Specified by:
setin interfaceList<IonValue>- Parameters:
index- index of the element to replace.element- element to be stored at the specified position.- Returns:
- the element previously at the specified index.
- Throws:
UnsupportedOperationException- at every call.- See Also:
-
isNullValue
boolean isNullValue()Returnsfalseat every call, since datagrams cannot be null.- Specified by:
isNullValuein interfaceIonValue- Returns:
false
-
getContainer
IonContainer getContainer()Gets the container of this value, ornullif this is not part of one.Datagrams always return
nullfrom this method, since by definition they have no container.- Specified by:
getContainerin interfaceIonValue
-
size
int size()Gets the number of elements in the datagram, not counting system elements.- Specified by:
sizein interfaceCollection<IonValue>- Specified by:
sizein interfaceIonContainer- Specified by:
sizein interfaceList<IonValue>- Returns:
- the number of elements, zero if
this.isNullValue().
-
systemSize
int systemSize()Gets the number of elements in the datagram, including system elements such as version markers and symbol tables. Unless your application needs to be aware of such low-level details, you almost certainly want to usesize()instead.- See Also:
-
get
Gets a selected non-system element from this datagram.- Specified by:
getin interfaceIonSequence- Specified by:
getin interfaceList<IonValue>- Parameters:
index- must be less than.size()- Returns:
- the selected element; not
null. - Throws:
IndexOutOfBoundsException- if the index is bad.
-
systemGet
Gets a selected element from this datagram, potentially getting a hidden system element (such as a symbol table). Unless your application needs to be aware of such low-level details, you almost certainly want to useget(int)instead.- Parameters:
index- must be less than.systemSize()- Returns:
- the selected element; not
null. - Throws:
IndexOutOfBoundsException- if the index is bad.- See Also:
-
iterator
Creates an iterator providing the (direct) elements of this datagram. Elements will be returned in order of their appearance in the Ion representation.This iterator returns only user values, ignoring symbol tables and other system values. It does not support the
Iterator.remove()operation. -
systemIterator
ListIterator<IonValue> systemIterator()Iterate all values in the datagram, including the otherwise-hidden system values such as version markers and symbol tables. Unless your application needs to be aware of such low-level details, you almost certainly want to useiterator()instead.This iterator does not support the modification methods
Iterator.remove(),ListIterator.add(Object), orListIterator.set(Object).- Returns:
- not null.
- See Also:
-
byteSize
Gets the number of bytes used to encode this datagram. As a side effect, this method encodes the entire datagram into Ion binary format.- Returns:
- the number of bytes in the binary encoding of this datagram.
- Throws:
IonException- if there's an error encoding the data.
-
toBytes
Deprecated.UsegetBytes()instead, which is renamed for consistency with other interfaces.Copies the binary-encoded form of this datagram into a new byte array.- Returns:
- a new, non-empty byte array containing the encoded datagram.
- Throws:
IonException- if there's an error encoding the data.
-
getBytes
Copies the binary-encoded form of this datagram into a new byte array.- Returns:
- a new, non-empty byte array containing the encoded datagram.
- Throws:
IonException- if there's an error encoding the data.
-
getBytes
Deprecated.Copies the binary-encoded form of this datagram into a given array.The given array must be large enough to contain all the bytes of this datagram.
An invocation of this method of the form
dg.get(a)behaves in exactly the same way as the invocation:dg.get(a, 0)- Parameters:
dst- the array into which bytes are to be written.- Returns:
- the number of bytes copied into
dst. - Throws:
IonException- if there's an error encoding the data.IndexOutOfBoundsException- ifdst.lengthis smaller than the result ofbyteSize().- See Also:
-
getBytes
Deprecated.Copies the binary-encoded form of this datagram into a given sub-array.The given subarray must be large enough to contain all the bytes of this datagram.
- Parameters:
dst- the array into which bytes are to be written.offset- the offset within the array of the first byte to be written; must be non-negative and no larger thandst.length- Returns:
- the number of bytes copied into
dst. - Throws:
IonException- if there's an error encoding the data.IndexOutOfBoundsException- if(dst.length - offset)is smaller than the result ofbyteSize().
-
getBytes
Copies the binary-encoded form of this datagram to a specified stream.- Parameters:
out- the output stream to which to write the data.- Returns:
- the number of bytes written.
- Throws:
IonException- if there's an error encoding the data.IOException- if an error occurs writing the data to the stream.
-
getSymbolTable
SymbolTable getSymbolTable()This inherited method is not supported by datagrams because there's no single symbol table used across the contents. Each value contained by the datagram may have its own symbol table.- Specified by:
getSymbolTablein interfaceIonValue- Returns:
- nothing, always throws an exception.
- Throws:
UnsupportedOperationException- at every call.
-
addTypeAnnotation
This inherited method is not supported by datagrams.- Specified by:
addTypeAnnotationin interfaceIonValue- Parameters:
annotation- as a string value.- Throws:
UnsupportedOperationException- at every call.
-
makeNull
void makeNull()This inherited method is not supported by datagrams.- Specified by:
makeNullin interfaceIonContainer- Throws:
UnsupportedOperationException- at every call.
-
clone
Description copied from interface:IonValueCreates a copy of this value and all of its children. The cloned value may use the same shared symbol tables, but it will have an independent local symbol table if necessary. The cloned value will be modifiable regardless of whether this instanceIonValue.isReadOnly().The cloned value will be created in the context of the same
ValueFactoryas this instance; if you want a copy using a different factory, then useValueFactory.clone(IonValue)instead.- Specified by:
clonein interfaceIonContainer- Specified by:
clonein interfaceIonSequence- Specified by:
clonein interfaceIonValue- Throws:
UnknownSymbolException- if any part of this value has unknown text but known Sid for its field name, annotation or symbol.
-
getBytes()instead, which is renamed for consistency with other interfaces.