当前位置: 首页>>代码示例>>Java>>正文


Java StreamHelper.writeSafeUTF方法代码示例

本文整理汇总了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;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:29,代码来源:AbstractWALDAO.java

示例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!
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:8,代码来源:ClassPathResource.java

示例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
}
 
开发者ID:phax,项目名称:ph-pdf-layout,代码行数:10,代码来源:PreloadFont.java

示例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);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:7,代码来源:JsonArray.java

示例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 ());
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:7,代码来源:JsonValue.java


注:本文中的com.helger.commons.io.stream.StreamHelper.writeSafeUTF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。