Skip to content

Commit

Permalink
PR: IO-582
Browse files Browse the repository at this point in the history
Make methods in ObservableInputStream.Obsever public.
  • Loading branch information
jochenw committed Jul 27, 2018
1 parent 078af45 commit 7b813b6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<!-- The release date is the date RC is cut -->
<release version="2.7" date="tba" description="tba">
<action issue="IO-582" dev="jochen" type="fix" due-to="Bruno Palos">
Make methods in ObservableInputStream.Obsever public.
</action>
<action issue="IO-535" dev="pschumacher" type="fix" due-to="Svetlin Zarev, Anthony Raymond">
Thread bug in FileAlterationMonitor#stop(int)
</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public MessageDigestMaintainingObserver(final MessageDigest pMd) {
}

@Override
public
void data(final int pByte) throws IOException {
md.update((byte) pByte);
}

@Override
public
void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
md.update(pBuffer, pOffset, pLength);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static abstract class Observer {
* because, in that case, {@link #finished()} will be invoked instead.
* @throws IOException if an i/o-error occurs
*/
void data(final int pByte) throws IOException {}
public void data(final int pByte) throws IOException {}

/** Called to indicate, that {@link InputStream#read(byte[])}, or
* {@link InputStream#read(byte[], int, int)} have been called, and are about to
Expand All @@ -55,26 +55,26 @@ void data(final int pByte) throws IOException {}
* @param pLength The number of bytes, which have been stored in the byte array.
* @throws IOException if an i/o-error occurs
*/
void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {}
public void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {}

/** Called to indicate, that EOF has been seen on the underlying stream.
* This method may be called multiple times, if the reader keeps invoking
* either of the read methods, and they will consequently keep returning
* EOF.
* @throws IOException if an i/o-error occurs
*/
void finished() throws IOException {}
public void finished() throws IOException {}

/** Called to indicate, that the {@link ObservableInputStream} has been closed.
* @throws IOException if an i/o-error occurs
*/
void closed() throws IOException {}
public void closed() throws IOException {}

/**
* Called to indicate, that an error occurred on the underlying stream.
* @throws IOException if an i/o-error occurs
*/
void error(final IOException pException) throws IOException { throw pException; }
public void error(final IOException pException) throws IOException { throw pException; }
}

private final List<Observer> observers = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,21 @@ private static class LastByteKeepingObserver extends Observer {
private boolean closed;

@Override
public
void data(final int pByte) throws IOException {
super.data(pByte);
lastByteSeen = pByte;
}

@Override
public
void finished() throws IOException {
super.finished();
finished = true;
}

@Override
public
void closed() throws IOException {
super.closed();
closed = true;
Expand All @@ -56,6 +59,7 @@ private static class LastBytesKeepingObserver extends Observer {
private int length = -1;

@Override
public
void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
super.data(pBuffer, pOffset, pLength);
buffer = pBuffer;
Expand Down

0 comments on commit 7b813b6

Please sign in to comment.