I2NP: Remove unused OutputStream methods

This commit is contained in:
zzz
2018-08-04 15:23:36 +00:00
parent 9b3eb8d2c3
commit 21fe962abd
4 changed files with 7 additions and 85 deletions

View File

@ -383,20 +383,11 @@ public class DeliveryInstructions extends DataStructureImpl {
/**
* @deprecated unused
* @throws UnsupportedOperationException always
*/
@Deprecated
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
if ( (_deliveryMode < 0) || (_deliveryMode > FLAG_MODE_TUNNEL) ) throw new DataFormatException("Invalid data: mode = " + _deliveryMode);
int flags = getFlags();
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Write flags: " + flags + " mode: " + getDeliveryMode()
// + " =?= " + flagMode(flags));
byte additionalInfo[] = getAdditionalInfo();
out.write((byte) flags);
if (additionalInfo != null) {
out.write(additionalInfo);
out.flush();
}
public void writeBytes(OutputStream out) {
throw new UnsupportedOperationException();
}
/**
@ -531,11 +522,6 @@ public class DeliveryInstructions extends DataStructureImpl {
throw new RuntimeException("immutable");
}
@Override
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
out.write((byte) 0);
}
@Override
public int writeBytes(byte target[], int offset) {
target[offset] = 0;

View File

@ -9,7 +9,6 @@ package net.i2p.data.i2np;
*/
import java.io.IOException;
import java.io.OutputStream;
import net.i2p.I2PAppContext;
import net.i2p.data.Base64;
@ -95,16 +94,6 @@ public abstract class FastI2NPMessageImpl extends I2NPMessageImpl {
return cur - offset;
}
/**
* @deprecated unused
* @throws UnsupportedOperationException
*/
@Deprecated
@Override
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
throw new UnsupportedOperationException();
}
/**
* This tests the reuse-checksum feature.
* The results are that mostly UnknownI2NPMessages (from inside a TGM),

View File

@ -101,57 +101,8 @@ public class GarlicClove extends DataStructureImpl {
* @throws UnsupportedOperationException always
*/
@Deprecated
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
public void writeBytes(OutputStream out) {
throw new UnsupportedOperationException();
/****
StringBuilder error = null;
if (_instructions == null) {
if (error == null) error = new StringBuilder();
error.append("No instructions ");
}
if (_msg == null) {
if (error == null) error = new StringBuilder();
error.append("No message ");
}
if (_cloveId < 0) {
if (error == null) error = new StringBuilder();
error.append("CloveID < 0 [").append(_cloveId).append("] ");
}
if (_expiration == null) {
if (error == null) error = new StringBuilder();
error.append("Expiration is null ");
}
if (_certificate == null) {
if (error == null) error = new StringBuilder();
error.append("Certificate is null ");
}
if ( (error != null) && (error.length() > 0) )
throw new DataFormatException(error.toString());
_instructions.writeBytes(out);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Wrote instructions: " + _instructions);
try {
byte m[] = _msg.toByteArray();
if (m == null)
throw new RuntimeException("foo, returned null");
if (m.length <= 0)
throw new RuntimeException("foo, returned 0 length");
out.write(m);
} catch (RuntimeException e) {
throw new DataFormatException("Unable to write the clove: " + _msg + " to " + out, e);
}
DataHelper.writeLong(out, 4, _cloveId);
DataHelper.writeDate(out, _expiration);
if (_log.shouldLog(Log.DEBUG))
_log.debug("CloveID written: " + _cloveId + " expiration written: "
+ _expiration);
_certificate.writeBytes(out);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Written cert: " + _certificate);
****/
}
/**

View File

@ -165,15 +165,11 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
* Don't do this if you need a byte array - use toByteArray()
*
* @deprecated unused
* @throws UnsupportedOperationException always
*/
@Deprecated
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
int size = getMessageSize();
if (size < 15 + CHECKSUM_LENGTH) throw new DataFormatException("Unable to build the message");
byte buf[] = new byte[size];
int read = toByteArray(buf);
if (read < 0) throw new DataFormatException("Unable to build the message");
out.write(buf, 0, read);
public void writeBytes(OutputStream out) {
throw new UnsupportedOperationException();
}
/**