38 |
String rcsid = "$Id$"; |
String rcsid = "$Id$"; |
39 |
|
|
40 |
boolean finalized = false; |
boolean finalized = false; |
41 |
Mediaserver.Id mediaserverId = null; |
BlockId mediaserverId = null; |
42 |
|
|
43 |
final StringBuffer current = new StringBuffer(); |
final StringBuffer current = new StringBuffer(); |
44 |
char[] curchars; |
char[] curchars; |
90 |
} |
} |
91 |
|
|
92 |
public String getID() { |
public String getID() { |
93 |
if(mediaserverId != null) return mediaserverId.getString(); |
if(mediaserverId != null) return mediaserverId.toString(); |
94 |
else return ""; |
else return ""; |
95 |
} |
} |
96 |
|
|
97 |
public Mediaserver.Id saveOrGetId(Mediaserver saveTo) |
public BlockId saveOrGetId(StormPool saveTo) |
98 |
throws java.io.IOException { |
throws java.io.IOException { |
99 |
if(finalized) |
if(finalized) |
100 |
return this.mediaserverId; // saved already |
return this.mediaserverId; // saved already |
104 |
|
|
105 |
byte[] bytes = current.toString().getBytes("UTF8"); |
byte[] bytes = current.toString().getBytes("UTF8"); |
106 |
String content_type = "text/plain; charset=UTF-8"; |
String content_type = "text/plain; charset=UTF-8"; |
107 |
|
|
108 |
|
BlockOutputStream stream = saveTo.getBlockOutputStream(content_type); |
109 |
|
stream.write(bytes); |
110 |
|
stream.close(); |
111 |
|
|
112 |
finalized = true; |
finalized = true; |
113 |
mediaserverId = saveTo.addDatum(bytes, content_type); //, assocId); |
mediaserverId = stream.getBlockId(); |
114 |
//id = mediaserverId.getString(); |
|
115 |
ScrollBlockManager.msCache.put(mediaserverId, this); |
ScrollBlockManager.msCache.put(mediaserverId, this); |
116 |
return mediaserverId; |
return mediaserverId; |
117 |
} |
} |