Class StreamAwareContentReaderProxy

  • All Implemented Interfaces:
    org.alfresco.service.cmr.repository.ContentAccessor, org.alfresco.service.cmr.repository.ContentReader

    public class StreamAwareContentReaderProxy
    extends AbstractStreamAwareProxy
    implements org.alfresco.service.cmr.repository.ContentReader
    Proxy for ContentReader which captures InputStream or ReadableByteChannel to introduce a possibility releasing captured resource
    Author:
    Dmitry Velichkevich
    See Also:
    ContentReader, AbstractStreamAwareProxy
    • Constructor Detail

      • StreamAwareContentReaderProxy

        public StreamAwareContentReaderProxy​(org.alfresco.service.cmr.repository.ContentReader delegator)
    • Method Detail

      • exists

        public boolean exists()
        Specified by:
        exists in interface org.alfresco.service.cmr.repository.ContentReader
      • getContent

        public void getContent​(java.io.OutputStream os)
                        throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getContent in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getContent

        public void getContent​(java.io.File file)
                        throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getContent in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getContentInputStream

        public java.io.InputStream getContentInputStream()
                                                  throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getContentInputStream in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getContentString

        public java.lang.String getContentString()
                                          throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getContentString in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getContentString

        public java.lang.String getContentString​(int length)
                                          throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getContentString in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getFileChannel

        public java.nio.channels.FileChannel getFileChannel()
                                                     throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getFileChannel in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getLastModified

        public long getLastModified()
        Specified by:
        getLastModified in interface org.alfresco.service.cmr.repository.ContentReader
      • getReadableChannel

        public java.nio.channels.ReadableByteChannel getReadableChannel()
                                                                 throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getReadableChannel in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • getReader

        public org.alfresco.service.cmr.repository.ContentReader getReader()
                                                                    throws org.alfresco.service.cmr.repository.ContentIOException
        Specified by:
        getReader in interface org.alfresco.service.cmr.repository.ContentReader
        Throws:
        org.alfresco.service.cmr.repository.ContentIOException
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface org.alfresco.service.cmr.repository.ContentReader
      • addListener

        public void addListener​(org.alfresco.service.cmr.repository.ContentStreamListener listener)
        Specified by:
        addListener in interface org.alfresco.service.cmr.repository.ContentAccessor
      • getContentData

        public org.alfresco.service.cmr.repository.ContentData getContentData()
        Specified by:
        getContentData in interface org.alfresco.service.cmr.repository.ContentAccessor
      • getContentUrl

        public java.lang.String getContentUrl()
        Specified by:
        getContentUrl in interface org.alfresco.service.cmr.repository.ContentAccessor
      • getEncoding

        public java.lang.String getEncoding()
        Specified by:
        getEncoding in interface org.alfresco.service.cmr.repository.ContentAccessor
      • getLocale

        public java.util.Locale getLocale()
        Specified by:
        getLocale in interface org.alfresco.service.cmr.repository.ContentAccessor
      • getMimetype

        public java.lang.String getMimetype()
        Specified by:
        getMimetype in interface org.alfresco.service.cmr.repository.ContentAccessor
      • getSize

        public long getSize()
        Specified by:
        getSize in interface org.alfresco.service.cmr.repository.ContentAccessor
      • isChannelOpen

        public boolean isChannelOpen()
        Specified by:
        isChannelOpen in interface org.alfresco.service.cmr.repository.ContentAccessor
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
        Specified by:
        setEncoding in interface org.alfresco.service.cmr.repository.ContentAccessor
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Specified by:
        setLocale in interface org.alfresco.service.cmr.repository.ContentAccessor
      • setMimetype

        public void setMimetype​(java.lang.String mimetype)
        Specified by:
        setMimetype in interface org.alfresco.service.cmr.repository.ContentAccessor
      • canBeClosed

        public boolean canBeClosed()
        Specified by:
        canBeClosed in class AbstractStreamAwareProxy
        Returns:
        Boolean value which determines whether stream can (true) or cannot ((false)) be closed
      • getStream

        public java.io.Closeable getStream()
        Specified by:
        getStream in class AbstractStreamAwareProxy
        Returns:
        Closeable instance which represents channel or stream which uses channel