@private
# File lib/aws/s3/cipher_io.rb, line 20 def initialize cipher, stream, stream_size = nil @stream = stream @stream_size = stream_size @orig_cipher = cipher.clone reset_cipher # add a #rewind method if the original stream can be rewound if @stream.respond_to?(:rewind) Core::MetaUtils.extend_method(self, :rewind) do reset_cipher @stream.rewind end end # add a #size method if the stream size is known if stream_size Core::MetaUtils.extend_method(self, :size) do EncryptionUtils.get_encrypted_size(@stream_size) end end end
@return [Boolean] Returns true
when the entire stream has been
read.
# File lib/aws/s3/cipher_io.rb, line 56 def eof? @eof end
@return [String] Returns the requested number of bytes. If no byte
amount is given, it will return the entire body of encrypted data
# File lib/aws/s3/cipher_io.rb, line 47 def read bytes = nil if bytes (@eof) ? nil : read_chunk(bytes) else (@eof) ? "" : read_all() end end