Skip to content

Commit

Permalink
extra ctors
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 22, 2017
1 parent aa2eb70 commit 3850f5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ To sort a list of words in the file:
```java
List<String> sorted = new SortedList<>(
new IterableAsList<>(
new TextAsLines(
new SplitText(
new BytesAsText(
new InputAsBytes(
new FileAsInput(
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/org/cactoos/text/BytesAsText.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.cactoos.Bytes;
import org.cactoos.Input;
import org.cactoos.Text;
import org.cactoos.io.InputAsBytes;

/**
* Bytes as Text.
Expand All @@ -53,6 +55,15 @@ public final class BytesAsText implements Text {
*/
private final Charset charset;

/**
* Ctor.
* @param input Bytes from the input
* @since 0.8
*/
public BytesAsText(final Input input) {
this(new InputAsBytes(input));
}

/**
* Ctor.
* @param bts Bytes to encapsulate
Expand All @@ -69,6 +80,16 @@ public BytesAsText(final Bytes bts) {
this(bts, StandardCharsets.UTF_8);
}

/**
* Ctor.
* @param input Input
* @param cset Charset
* @since 0.8
*/
public BytesAsText(final Input input, final Charset cset) {
this(new InputAsBytes(input), cset);
}

/**
* Ctor.
* @param bts Bytes to encapsulate
Expand Down

0 comments on commit 3850f5b

Please sign in to comment.