Formatting

This commit is contained in:
Phillip Webb
2018-05-04 12:06:19 -07:00
parent 86f43c4750
commit 6e09e497f2
96 changed files with 217 additions and 135 deletions

View File

@@ -57,8 +57,10 @@ public interface RandomAccessData {
* @param length the number of bytes to be read
* @return the data
* @throws IOException if the data cannot be read
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or subsection
* @throws EOFException if offset plus length is greater than the length of the file or subsection
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or
* subsection
* @throws EOFException if offset plus length is greater than the length of the file
* or subsection
*/
byte[] read(long offset, long length) throws IOException;

View File

@@ -110,20 +110,23 @@ public class RandomAccessDataFileTests {
}
@Test
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException() throws Exception {
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(IndexOutOfBoundsException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(11, 0);
}
@Test
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException() throws Exception {
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class);
this.file.read(256, 1);
}
@Test
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException() throws Exception {
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(10, 1);

View File

@@ -199,4 +199,5 @@ public class AsciiBytesTests {
private void matchesSameAsString(String input) {
assertThat(new AsciiBytes(input).matches(input, NO_SUFFIX)).isTrue();
}
}