public class ArtifactAstSerializerMetadataSerializer extends Object
ArtifactAst serialization. This metadata is generated during the artifact's serialization and
must be added to the resulting InputStream so that it can be then read in order to use the correct deserializing
implementation when deserializing.
The metadata is added to the stream in the form of a header string in the first line of the InputStream. This header
string is composed by the serializer's id and the version, delimited by a pound sign (#). The max allowed length of the header
string is as determined by the MAX_HEADER_LINE_LENGTH constant.
| Modifier and Type | Field and Description |
|---|---|
static String |
DELIMITER |
static char |
END_HEADER_DELIMITER |
| Constructor and Description |
|---|
ArtifactAstSerializerMetadataSerializer() |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
addArtifactAstSerializerMetadataToInputStream(InputStream inputStream,
ArtifactAstSerializerMetadata artifactAstSerializerMetadata)
This method serializes the
ArtifactAstSerializerMetadata into a header string and adds it as a first line to the
provided serialized ArtifactAst which should be an InputStream |
ArtifactAstSerializerMetadata |
readArtifactAstSerializerMetadataFromInputStream(InputStream inputStream)
This method reads the metadata from an
InputStream by reading the first line which should be a header string in a
serialized ArtifactAst). |
public static final char END_HEADER_DELIMITER
public static final String DELIMITER
public ArtifactAstSerializerMetadataSerializer()
public ArtifactAstSerializerMetadata readArtifactAstSerializerMetadataFromInputStream(InputStream inputStream) throws IOException
InputStream by reading the first line which should be a header string in a
serialized ArtifactAst). This header string is composed by the serializer's id and the
version, delimited by a pound sign (#).
The max allowed length of the header string is as determined by the
MAX_HEADER_LINE_LENGTH constant. Since this method only read the first line, the rest of the input stream will be
still available for consumption.
inputStream - a serialized ArtifactAst generated by an
ArtifactAstSerializerArtifactAstSerializerMetadata instance containing the id and version indicated in the input stream's
metadata.IOException - If an I/O error occurspublic InputStream addArtifactAstSerializerMetadataToInputStream(InputStream inputStream, ArtifactAstSerializerMetadata artifactAstSerializerMetadata)
ArtifactAstSerializerMetadata into a header string and adds it as a first line to the
provided serialized ArtifactAst which should be an InputStreaminputStream - the serialized ArtifactAst created with an
ArtifactAstSerializerartifactAstSerializerMetadata - the ArtifactAstSerializerMetadata that represents the information associated
with the ArtifactAstSerializer used to
generate the given InputStreamInputStream whose first line is the serialized ArtifactAstSerializerMetadata and is followed by
the contents of the given serialized ArtifactAst's InputStreamCopyright © 2022 MuleSoft, Inc.. All rights reserved.