| 115 | /// Wraps a Storage object as a Data object. |
| 116 | /// |
| 117 | class StorageData implements Data { |
| 118 | private final String key; |
| 119 | |
| 120 | /// Creates a new Data wrapper for a storage key. |
| 121 | /// |
| 122 | /// #### Parameters |
| 123 | /// |
| 124 | /// - `key`: The storage key. |
| 125 | public StorageData(String key) { |
| 126 | this.key = key; |
| 127 | } |
| 128 | |
| 129 | /// {@inheritDoc } |
| 130 | @Override |
| 131 | public void appendTo(OutputStream output) throws IOException { |
| 132 | Util.copyNoClose(Storage.getInstance().createInputStream(key), output, 8192); |
| 133 | } |
| 134 | |
| 135 | /// {@inheritDoc } |
| 136 | @Override |
| 137 | public long getSize() throws IOException { |
| 138 | return Storage.getInstance().entrySize(key); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /// Wraps a byte[] array as a Data object. |
| 143 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected