[bug-65639] add doc about lack of thread saftey

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894439 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-10-21 10:14:10 +00:00
parent fa00e7d472
commit f454cfa63a
1 changed files with 10 additions and 0 deletions

View File

@ -91,12 +91,22 @@ public class FontEmbeddedData extends RecordAtom implements FontFacet {
out.write(_data);
}
/**
* Overwrite the font data. Reading values from this FontEmbeddedData instance while calling setFontData
* is not thread safe.
* @param fontData new font data
*/
public void setFontData(byte[] fontData) {
fontHeader = null;
_data = fontData.clone();
LittleEndian.putInt(_header, 4, _data.length);
}
/**
* Read the font data. Reading values from this FontEmbeddedData instance while calling {@link #setFontData(byte[])}
* is not thread safe.
* @return font data
*/
public FontHeader getFontHeader() {
if (fontHeader == null) {
FontHeader h = new FontHeader();