Java Code Examples for com.helger.commons.io.stream.StreamHelper#writeSafeUTF()
The following examples show how to use
com.helger.commons.io.stream.StreamHelper#writeSafeUTF() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractWALDAO.java From ph-commons with Apache License 2.0 | 5 votes |
@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 Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error writing WAL file " + aWALRes, ex); triggerExceptionHandlersWrite (ex, sWALFilename, (IMicroDocument) null); } return ESuccess.FAILURE; }
Example 2
Source File: ClassPathResource.java From ph-commons with Apache License 2.0 | 5 votes |
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! }
Example 3
Source File: JsonArray.java From ph-commons with Apache License 2.0 | 4 votes |
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException { aOOS.writeInt (m_aValues.size ()); final String sJson = getAsJsonString (); StreamHelper.writeSafeUTF (aOOS, sJson); }
Example 4
Source File: JsonObject.java From ph-commons with Apache License 2.0 | 4 votes |
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException { aOOS.writeInt (m_aValues.size ()); final String sJson = getAsJsonString (); StreamHelper.writeSafeUTF (aOOS, sJson); }
Example 5
Source File: JsonValue.java From ph-commons with Apache License 2.0 | 4 votes |
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException { final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (); appendAsJsonString (aWriter); StreamHelper.writeSafeUTF (aOOS, aWriter.getAsString ()); }
Example 6
Source File: BasicSerializationConverterRegistrar.java From ph-commons with Apache License 2.0 | 4 votes |
public void writeConvertedObject (@Nonnull final Charset aSourceObject, @Nonnull final ObjectOutputStream aOOS) throws IOException { StreamHelper.writeSafeUTF (aOOS, aSourceObject.name ()); }
Example 7
Source File: StringInputStreamProvider.java From ph-commons with Apache License 2.0 | 4 votes |
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException { StreamHelper.writeSafeUTF (aOOS, m_sData); SerializationConverter.writeConvertedObject (m_aCharset, aOOS); }