MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / StorageData

Class StorageData

CodenameOne/src/com/codename1/io/Data.java:117–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected