Skip to content

Commit b201c72

Browse files
docs and mem optimizations...
1 parent 5ae1592 commit b201c72

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

SerialX-core/src/main/java/org/ugp/serialx/Serializer.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public String Code(Object code)
254254
*
255255
* @see Serializer#stringify(Object...)
256256
*/
257-
public String toString(boolean serialize) throws IOException
257+
public String toString(boolean serialize)
258258
{
259259
if (serialize)
260260
return stringify();
@@ -290,7 +290,7 @@ public void serializeTo(boolean append, File f, Object... args) throws IOExcepti
290290
//double t0 = System.nanoTime();
291291
Writer writer = new BufferedWriter(new FileWriter(f, append));
292292

293-
writer.write(stringify(args));
293+
serializeTo(writer, args);
294294

295295
writer.close();
296296

@@ -314,13 +314,22 @@ public void serializeTo(boolean append, File f, Object... args) throws IOExcepti
314314
*
315315
* @return String with objects serialized in specific format.
316316
*
317+
* @throws RuntimeException IOException, but it should not occur in this case...
318+
*
317319
* @since 1.0.0
318320
*
319321
* @see Serializer#serializeTo(Appendable, Object...)
320322
*/
321-
public String stringify(Object... args) throws IOException
323+
public String stringify(Object... args)
322324
{
323-
return serializeTo(new StringBuilder(), args).toString();
325+
try
326+
{
327+
return serializeTo(new StringBuilder(), args).toString();
328+
}
329+
catch (IOException e)
330+
{
331+
throw new RuntimeException(e); // Should not occur...
332+
}
324333
}
325334

326335
/**
@@ -329,6 +338,8 @@ public String stringify(Object... args) throws IOException
329338
*
330339
* @return Source {@link OutputStream} with variables and objects serialized in specific format (may or may not be flushed).
331340
*
341+
* @throws IOException When appending the {@link OutputStream} throws....
342+
*
332343
* @since 1.3.2
333344
*
334345
* @see Serializer#serializeTo(Appendable, Object...)
@@ -434,6 +445,8 @@ public <S extends Scope> S loadFrom(Reader reader) throws IOException
434445
/**
435446
* @return Clone of this {@link Serializer} without variables and values, protocols and parser will remain same!
436447
*
448+
* @throws Exception When creating the new instance fails...
449+
*
437450
* @since 1.3.2
438451
*/
439452
public Serializer emptyClone() throws Exception
@@ -446,6 +459,8 @@ public Serializer emptyClone() throws Exception
446459
*
447460
* @return Clone of this {@link Serializer} without variables and values, protocols and parser will remain same!
448461
*
462+
* @throws Exception When creating the new instance fails...
463+
*
449464
* @since 1.3.2
450465
*/
451466
public Serializer emptyClone(Scope parent) throws Exception
@@ -458,7 +473,8 @@ public Serializer emptyClone(Scope parent) throws Exception
458473
* @param parent | Parent scope of new Serializer instance!
459474
*
460475
* @return Clone of this {@link Serializer} without variables and values, protocols and parser will remain same!
461-
* @throws Exception
476+
*
477+
* @throws Exception When creating the new instance fails...
462478
*
463479
* @since 1.3.5
464480
*/

SerialX-core/src/main/java/org/ugp/serialx/protocols/SerializationProtocol.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ public void setActive(boolean isActive)
171171
* @return Array of objects to serialize created from given object. Object will be serialized via protocol picked from {@link SerializationProtocol#REGISTRY}.
172172
* {@link SerializationProtocol#serialize(Class, Object...)} method of picked protocol will be called! Null will be returned if no protocol was found and you will be prompted with error message!
173173
*
174+
* @throws Exception Depends on the implementation of {@link SerializationProtocol#serialize(Object)}.
175+
*
174176
* @since 1.3.0
175177
*/
176178
public static <O> Object[] serializeObj(O object) throws Exception
@@ -186,6 +188,8 @@ public static <O> Object[] serializeObj(O object) throws Exception
186188
* @return Array of objects to serialize created from given object. Object will be serialized via protocol picked from registry.
187189
* {@link SerializationProtocol#serialize(Class, Object...)} method of picked protocol will be called! Null will be returned if no protocol was found and you will be prompted with error message!
188190
*
191+
* @throws Exception Depends on the implementation of {@link SerializationProtocol#serialize(Object)}.
192+
*
189193
* @since 1.3.0
190194
*/
191195
public static <O> Object[] serializeObj(ProtocolRegistry registry, long aditionalType, O object) throws Exception

SerialX-juss/src/main/java/org/ugp/serialx/juss/JussSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ <th>Obtained serializer content (return)</th>
949949
</tr>
950950
</table>
951951
*
952-
* @throws If something went wrong during deserialization!
952+
* @throws Exception If something went wrong during deserialization!
953953
*
954954
* @since 1.3.5
955955
*/

0 commit comments

Comments
 (0)