本文整理汇总了Java中com.helger.commons.io.stream.StreamHelper.writeSafeUTF方法的典型用法代码示例。如果您正苦于以下问题:Java StreamHelper.writeSafeUTF方法的具体用法?Java StreamHelper.writeSafeUTF怎么用?Java StreamHelper.writeSafeUTF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.io.stream.StreamHelper
的用法示例。
在下文中一共展示了StreamHelper.writeSafeUTF方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _writeWALFile
import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
@Nonnull
@MustBeLocked (ELockType.WRITE)
private ESuccess _writeWALFile (@Nonnull @Nonempty final List <DATATYPE> aModifiedElements,
@Nonnull final EDAOActionType eActionType,
@Nonnull @Nonempty final String sWALFilename)
{
final FileSystemResource aWALRes = m_aIO.getResource (sWALFilename);
try (final DataOutputStream aDOS = new DataOutputStream (aWALRes.getOutputStream (EAppend.APPEND)))
{
// Write action type ID
StreamHelper.writeSafeUTF (aDOS, eActionType.getID ());
// Write number of elements
aDOS.writeInt (aModifiedElements.size ());
// Write all data elements as XML Strings :)
for (final DATATYPE aModifiedElement : aModifiedElements)
{
final String sElement = convertNativeToWALString (aModifiedElement);
StreamHelper.writeSafeUTF (aDOS, sElement);
}
return ESuccess.SUCCESS;
}
catch (final Throwable t)
{
s_aLogger.error ("Error writing WAL file " + aWALRes, t);
triggerExceptionHandlersWrite (t, sWALFilename, (IMicroDocument) null);
}
return ESuccess.FAILURE;
}
示例2: writeObject
import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException
{
if (m_aClassLoader != null)
throw new IOException ("Cannot serialize a ClassPathResource that has a specific ClassLoader!");
StreamHelper.writeSafeUTF (aOOS, m_sPath);
// Don't write the rest! After serialization the URL must be resolved again!
}
示例3: writeObject
import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
private void writeObject (@Nonnull @WillNotClose final ObjectOutputStream aOOS) throws IOException
{
StreamHelper.writeSafeUTF (aOOS, m_sID);
StreamHelper.writeSafeUTF (aOOS, m_aFont != null ? m_aFont.getName () : null);
aOOS.writeObject (m_aFontRes);
aOOS.writeBoolean (m_bEmbed);
aOOS.writeInt (m_nFallbackCodePoint);
// TTF and OTF are not written
}
示例4: writeObject
import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException
{
aOOS.writeInt (m_aValues.size ());
final String sJson = getAsJsonString ();
StreamHelper.writeSafeUTF (aOOS, sJson);
}
示例5: writeObject
import com.helger.commons.io.stream.StreamHelper; //导入方法依赖的package包/类
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException
{
final NonBlockingStringWriter aWriter = new NonBlockingStringWriter ();
appendAsJsonString (aWriter);
StreamHelper.writeSafeUTF (aOOS, aWriter.getAsString ());
}