Class SerializerArtifact

    • Constructor Summary

      Constructors 
      Constructor Description
      SerializerArtifact​(Artifact parent, java.lang.String name, java.lang.String ext, ArtifactType type, Serializer serializer, long lastModified)
      Constructs a new artifact that is based on a content serializer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getContentLength()
      Returns the length of the serialized data if it's known without doing the actual serialization.
      java.lang.String getContentType()
      Returns the content type of the serialized data or null if the type is not known or cannot be determined.
      VaultInputSource getInputSource()
      Returns an input source to the contents of this artifact.
      java.io.InputStream getInputStream()
      Returns the input stream to the contents of this artifact.
      long getLastModified()
      Returns the last modified date or 0 if not known.
      AccessType getPreferredAccess()
      Returns the preferred access value for this artifact.
      SerializationType getSerializationType()
      Returns the serialization type of this artifact.
      void spool​(java.io.OutputStream out)
      Writes the content to the given output stream and closes it afterwards.
      • Methods inherited from class org.apache.jackrabbit.vault.fs.impl.AbstractArtifact

        dump, equals, getExtension, getPlatformPath, getRelativePath, getType, hashCode, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.jackrabbit.vault.fs.api.Dumpable

        dump
    • Constructor Detail

      • SerializerArtifact

        public SerializerArtifact​(Artifact parent,
                                  java.lang.String name,
                                  java.lang.String ext,
                                  ArtifactType type,
                                  Serializer serializer,
                                  long lastModified)
        Constructs a new artifact that is based on a content serializer.
        Parameters:
        parent - the parent artifact
        name - the name of the artifact
        ext - the extension of the artifact
        type - the type of the artifact
        serializer - the serializer to use for the content
        lastModified - the last modified date
        Throws:
        java.lang.IllegalArgumentException - if the type is not suitable.
    • Method Detail

      • getSerializationType

        public SerializationType getSerializationType()
        Returns the serialization type of this artifact.
        Specified by:
        getSerializationType in interface Artifact
        Returns:
        the serialization type of this artifact.
      • spool

        public void spool​(java.io.OutputStream out)
                   throws java.io.IOException,
                          RepositoryException
        Writes the content to the given output stream and closes it afterwards. This is the preferred method to use for output-artifacts.

        The specified stream remains open after this method returns.

        Specified by:
        spool in interface Artifact
        Overrides:
        spool in class org.apache.jackrabbit.vault.fs.impl.AbstractArtifact
        Parameters:
        out - the output stream to spool to
        Throws:
        java.io.IOException - if an I/O error occurs
        RepositoryException - if a repository error occurs
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException,
                                                  RepositoryException
        Returns the input stream to the contents of this artifact. This is the preferred method to use for input-artifacts.
        Specified by:
        getInputStream in interface Artifact
        Returns:
        a input stream to the contents of this artifact.
        Throws:
        java.io.IOException - if an I/O error occurs
        RepositoryException - if a repository error occurs
      • getContentType

        public java.lang.String getContentType()
        Returns the content type of the serialized data or null if the type is not known or cannot be determined.
        Specified by:
        getContentType in interface Artifact
        Overrides:
        getContentType in class org.apache.jackrabbit.vault.fs.impl.AbstractArtifact
        Returns:
        the content type or null.
      • getContentLength

        public long getContentLength()
        Returns the length of the serialized data if it's known without doing the actual serialization.
        Specified by:
        getContentLength in interface Artifact
        Returns:
        the length or -1 if the length cannot be determined.
      • getLastModified

        public long getLastModified()
        Returns the last modified date or 0 if not known.
        Specified by:
        getLastModified in interface Artifact
        Returns:
        the last modified date or 0