Skip to content

Commit

Permalink
fixed #312
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardHightower committed Apr 21, 2015
1 parent 970663e commit 47eb53d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 2 additions & 4 deletions reflekt/src/main/java/io/advantageous/boon/core/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public static void print(Object message) {
print("<NULL>");
} else if (message instanceof char[]) {
print(FastStringUtils.noCopyStringFromChars((char[]) message));

} else if (message.getClass().isArray()) {
print(Lists.toListOrSingletonList(message).toString());
} else {
Expand All @@ -161,10 +162,7 @@ public static void print(Object message) {
*/
public static void puts(Object... messages) {

for (Object message : messages) {
print(message);
}
println();
println(Str.sputs(messages));

}

Expand Down
7 changes: 6 additions & 1 deletion reflekt/src/main/java/io/advantageous/boon/core/Str.java
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,12 @@ public static CharBuf sputs(CharBuf buf, Object... messages) {

if (message == null) {
buf.add("<NULL>");
} else if (message.getClass().isArray()) {
} if (message instanceof char[]) {

buf.add(((char[]) message));
}

else if (message.getClass().isArray()) {
buf.add(toListOrSingletonList(message).toString());
} else {
buf.add(message.toString());
Expand Down
7 changes: 7 additions & 0 deletions reflekt/src/test/java/io/advantageous/boon/core/IOTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ public void testReadFromHttp() throws Exception {
}


@Test
public void testSprint() throws Exception {

final String str = Str.sputs("str", "char_array".toCharArray(), 1, 2);
assertEquals("str char_array 1 2\n", str);
}

@Test
public void testReadEachLineHttp() throws Exception {

Expand Down

0 comments on commit 47eb53d

Please sign in to comment.