Skip to content

Commit

Permalink
#408 InputStreamOf fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 22, 2017
1 parent 9b8822b commit 7ab6b52
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/org/cactoos/io/InputStreamOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,29 @@ public void close() throws IOException {
this.source.value().close();
}

@Override
public long skip(final long num) throws IOException {
return this.source.value().skip(num);
}

@Override
public int available() throws IOException {
return this.source.value().available();
}

@Override
public void mark(final int limit) {
this.source.value().mark(limit);
}

@Override
public void reset() throws IOException {
this.source.value().reset();
}

@Override
public boolean markSupported() {
return this.source.value().markSupported();
}

}
5 changes: 5 additions & 0 deletions src/main/java/org/cactoos/io/OutputStreamTo.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,9 @@ public void close() throws IOException {
this.target.value().close();
}

@Override
public void flush() throws IOException {
this.target.value().flush();
}

}
10 changes: 10 additions & 0 deletions src/test/java/org/cactoos/io/InputOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,14 @@ public void readsAnArrayOfBytes() throws Exception {
);
}

@Test
public void makesDataAvailable() throws IOException {
final String content = "Hello,חבר!";
MatcherAssert.assertThat(
"Can't show that data is available",
new InputOf(content).stream().available(),
Matchers.greaterThan(0)
);
}

}
11 changes: 11 additions & 0 deletions src/test/java/org/cactoos/io/InputStreamOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.nio.file.Path;
import org.cactoos.InputHasContent;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
Expand Down Expand Up @@ -75,4 +76,14 @@ public void readsFromReaderThroughSmallBuffer() {
);
}

@Test
public void makesDataAvailable() throws IOException {
final String content = "Hello,חבר!";
MatcherAssert.assertThat(
"Can't show that data is available",
new InputStreamOf(content).available(),
Matchers.greaterThan(0)
);
}

}

0 comments on commit 7ab6b52

Please sign in to comment.