Skip to content

Commit

Permalink
Changed isDataEmpty() to hasContent().
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cover jdcove2 committed Mar 8, 2024
1 parent d9b6590 commit 973e4ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/emissary/core/BaseDataObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ public void setData(@Nullable final byte[] newData, final int offset, final int
* @return if data is undefined or zero length.
*/
@Override
public boolean isDataEmpty() throws IOException {
return getDataState() == DataState.NO_DATA || getChannelSize() == 0;
public boolean hasContent() throws IOException {
return getChannelSize() > 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/core/IBaseDataObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ enum MergePolicy {
*
* @return if data is undefined or zero length.
*/
boolean isDataEmpty() throws IOException;
boolean hasContent() throws IOException;

/**
* Set the byte channel factory using whichever implementation is providing access to the data.
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/emissary/core/BaseDataObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ void testIsDataEmpty() throws IOException {
final IBaseDataObject zeroLengthDataIbdo = new BaseDataObject(new byte[0], "zeroLengthDataIbdo");
final IBaseDataObject nonZeroLengthDataIbdo = new BaseDataObject(new byte[1], "nonZeroLengthDataIbdo");

assertTrue(nullDataIbdo.isDataEmpty());
assertTrue(zeroLengthDataIbdo.isDataEmpty());
assertFalse(nonZeroLengthDataIbdo.isDataEmpty());
assertFalse(nullDataIbdo.hasContent());
assertFalse(zeroLengthDataIbdo.hasContent());
assertTrue(nonZeroLengthDataIbdo.hasContent());
}

@Test
Expand Down

0 comments on commit 973e4ae

Please sign in to comment.