Java Code Examples for com.helger.commons.io.stream.StreamHelper#readSafeUTF()

The following examples show how to use com.helger.commons.io.stream.StreamHelper#readSafeUTF() . 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: JsonArray.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
private void readObject (@Nonnull final ObjectInputStream aOIS) throws IOException
{
  final int nInitialSize = aOIS.readInt ();
  m_aValues = new CommonsArrayList <> (nInitialSize);
  final String sJson = StreamHelper.readSafeUTF (aOIS);
  final JsonArray aJson = (JsonArray) JsonReader.readFromString (sJson);
  if (aJson == null)
    throw new IOException ("Failed to parse JSON array:\n" + sJson);
  m_aValues.addAll (aJson.m_aValues);
}
 
Example 2
Source File: JsonObject.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
private void readObject (@Nonnull final ObjectInputStream aOIS) throws IOException
{
  final int nInitialSize = aOIS.readInt ();
  m_aValues = new CommonsLinkedHashMap <> (nInitialSize);
  final String sJson = StreamHelper.readSafeUTF (aOIS);
  final JsonObject aJson = (JsonObject) JsonReader.readFromString (sJson);
  if (aJson == null)
    throw new IOException ("Failed to parse JSON object:\n" + sJson);
  m_aValues.putAll (aJson.m_aValues);
}
 
Example 3
Source File: JsonValue.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
private void readObject (@Nonnull final ObjectInputStream aOIS) throws IOException
{
  final String sJson = StreamHelper.readSafeUTF (aOIS);
  final JsonValue aJson = (JsonValue) JsonReader.readFromString (sJson);
  m_aValue = aJson.m_aValue;
}
 
Example 4
Source File: BasicSerializationConverterRegistrar.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
public Charset readConvertedObject (@Nonnull final ObjectInputStream aOIS) throws IOException
{
  final String sCharsetName = StreamHelper.readSafeUTF (aOIS);
  return CharsetHelper.getCharsetFromName (sCharsetName);
}
 
Example 5
Source File: ClassPathResource.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
private void readObject (@Nonnull final ObjectInputStream aOIS) throws IOException
{
  m_sPath = StreamHelper.readSafeUTF (aOIS);
}
 
Example 6
Source File: StringInputStreamProvider.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
private void readObject (@Nonnull final ObjectInputStream aOIS) throws IOException
{
  m_sData = StreamHelper.readSafeUTF (aOIS);
  m_aCharset = SerializationConverter.readConvertedObject (aOIS, Charset.class);
}