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

Class FileData

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

Source from the content-addressed store, hash-verified

87 /// Wraps a File as a Data object.
88 ///
89 class FileData implements Data {
90 private final File file;
91
92 /// Creates a new Data wrapper for a file.
93 ///
94 /// #### Parameters
95 ///
96 /// - `file`: The file to be wrapped.
97 public FileData(File file) {
98 this.file = file;
99 }
100
101 /// {@inheritDoc }
102 @Override
103 public void appendTo(OutputStream output) throws IOException {
104 FileSystemStorage fs = FileSystemStorage.getInstance();
105 Util.copyNoClose(fs.openInputStream(file.getAbsolutePath()), output, 8192);
106 }
107
108 /// {@inheritDoc }
109 @Override
110 public long getSize() throws IOException {
111 return file.length();
112 }
113 }
114
115 /// Wraps a Storage object as a Data object.
116 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected