def import_stream(self, directory):
<EOL>with open(os.path.join(directory, "<STR_LIT>"), "<STR_LIT:r>") as f:<EOL><INDENT>sdata = json.load(f)<EOL><DEDENT>s = self[sdata["<STR_LIT:name>"]]<EOL>if s.exists():<EOL><INDENT>raise ValueError("<STR_LIT>" + s.name + "<STR_LIT>")<EOL><DEDENT>s.create()<EOL>ddb = DatabaseConnection(self.apikey, url=self.db.baseurl)<EOL>d = Device(ddb, self.path)<EOL>sown = d[s.name]<EOL>sown.insert_array(DatapointArray().loadExport(directory))<EOL>if (sdata["<STR_LIT>"] and self.db.path != self.path):<EOL><INDENT>s.downlink = True<EOL>with open(os.path.join(directory, "<STR_LIT>"), "<STR_LIT:r>") as f:<EOL><INDENT>s.insert_array(json.load(f))<EOL><DEDENT><DEDENT>del sdata["<STR_LIT:name>"]<EOL>s.set(sdata)<EOL>
Imports a stream from the given directory. You export the Stream
        by using stream.export()