X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2FConnection.java;h=93775792b9ed4f0f6ec37c9d8a28dae44c15d4c5;hb=6a38dc83de243eeef3dc1fc8ae1daf285fe933fc;hp=b8bee320bc8f434341e17e4ca395f1195f97d1c0;hpb=3c80e17df7d3404a853c8782de55467be48d6ba1;p=sonitus.git diff --git a/src/main/java/net/pterodactylus/sonitus/data/Connection.java b/src/main/java/net/pterodactylus/sonitus/data/Connection.java index b8bee32..9377579 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Connection.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Connection.java @@ -54,10 +54,15 @@ public abstract class Connection implements Runnable { try { byte[] buffer = source.get(bufferSize()); feed(buffer); - } catch (IOException e) { - return; + } catch (IOException ioe1) { + break; } } + try { + finish(); + } catch (IOException ioe1) { + /* well, what can we do? nothing. */ + } } // @@ -82,4 +87,12 @@ public abstract class Connection implements Runnable { */ protected abstract void feed(byte[] buffer) throws IOException; + /** + * Notifies the sink that the source does not deliver any more data. + * + * @throws IOException + * if an I/O error occurs + */ + protected abstract void finish() throws IOException; + }