Skip to content

Unsynchronized ByteArrayInputStream implementation#109

Merged
garydgregory merged 2 commits into
apache:masterfrom
adamretter:iostreams-fastis
Apr 9, 2020
Merged

Unsynchronized ByteArrayInputStream implementation#109
garydgregory merged 2 commits into
apache:masterfrom
adamretter:iostreams-fastis

Conversation

@adamretter

@adamretter adamretter commented Apr 8, 2020

Copy link
Copy Markdown
Contributor

Builds upon the previous work of #108 by adding an UnsynchronizedByteArrayInputStream.

Calls to UnsynchronizedByteArrayOutputStream#toInputStream() now return UnsynchronizedByteArrayInputStream as the implementation instead of java.io.ByteArrayInputStream.

@garydgregory garydgregory left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamretter
Thank you for your PR. Please see my comments.

private int markedOffset;

/**
* @param data the buffer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a comment here.

}

/**
* @param data the buffer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a comment here.



/**
* @param data the buffer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a comment here.

import org.junit.jupiter.api.Test;

import static org.apache.commons.io.input.UnsynchronizedByteArrayInputStream.END_OF_STREAM;
import static org.junit.jupiter.api.Assertions.*;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid * imports.

/**
* Basic unit tests for the alternative ByteArrayInputStream implementation.
*/
public class UnsynchronizedByteArrayInputStreamTest {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new files, I like to keep method in alphabetical order, it makes it easier to find stuff.

@adamretter

Copy link
Copy Markdown
Contributor Author

Thanks @garydgregory I have just pushed a commit addressing your feedback.

@garydgregory

Copy link
Copy Markdown
Member

@garydgregory garydgregory merged commit b3960d9 into apache:master Apr 9, 2020
brettlounsbury pushed a commit to brettlounsbury/commons-io that referenced this pull request May 28, 2020
* Add a non-synchronized ByteArrayInputStream implementation - FastByteArrayInputStream

* Address review comments by @garydgregory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants