add Closeable/Flushable interfaces

This commit is contained in:
zzz
2015-08-27 14:36:19 +00:00
parent 5a11a28a35
commit 601376561b
15 changed files with 34 additions and 15 deletions

View File

@@ -22,6 +22,7 @@
package net.i2p.addressbook;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -41,7 +42,7 @@ import java.util.NoSuchElementException;
*
* @since 0.8.7
*/
class ConfigIterator implements Iterator<Map.Entry<String, String>> {
class ConfigIterator implements Iterator<Map.Entry<String, String>>, Closeable {
private BufferedReader input;
private ConfigEntry next;

View File

@@ -20,6 +20,7 @@
package org.klomp.snark;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -50,7 +51,7 @@ import net.i2p.util.SystemVersion;
/**
* Maintains pieces on disk. Can be used to store and retrieve pieces.
*/
public class Storage
public class Storage implements Closeable
{
private final MetaInfo metainfo;
private final List<TorrentFile> _torrentFiles;

View File

@@ -9,6 +9,7 @@ package net.i2p.sam;
*/
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
@@ -31,7 +32,7 @@ import net.i2p.util.Log;
*
* @author human
*/
abstract class SAMMessageSession {
abstract class SAMMessageSession implements Closeable {
protected final Log _log;
private I2PSession session;

View File

@@ -1,5 +1,6 @@
package net.i2p.client.streaming.impl;
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
@@ -25,7 +26,7 @@ import net.i2p.util.SimpleTimer2;
*<p>
* MessageOutputStream -> ConnectionDataReceiver -> Connection -> PacketQueue -> I2PSession
*/
class PacketQueue implements SendMessageStatusListener {
class PacketQueue implements SendMessageStatusListener, Closeable {
private final I2PAppContext _context;
private final Log _log;
private final ByteCache _cache = ByteCache.getInstance(64, 36*1024);

View File

@@ -1,8 +1,10 @@
package net.i2p.client.streaming.impl;
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.Flushable;
import java.io.IOException;
import java.io.OutputStream;
@@ -41,7 +43,7 @@ import net.i2p.data.DataHelper;
*
* @since 0.9.4
*/
public class PcapWriter {
public class PcapWriter implements Closeable, Flushable {
/** big-endian, see file format ref - 24 bytes */
private static final byte[] FILE_HEADER = { (byte) 0xa1, (byte) 0xb2, (byte) 0xc3, (byte) 0xd4,