forked from I2P_Developers/i2p.i2p
I2NP: Remove unused OutputStream methods
This commit is contained in:
@ -383,20 +383,11 @@ public class DeliveryInstructions extends DataStructureImpl {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated unused
|
* @deprecated unused
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) {
|
||||||
if ( (_deliveryMode < 0) || (_deliveryMode > FLAG_MODE_TUNNEL) ) throw new DataFormatException("Invalid data: mode = " + _deliveryMode);
|
throw new UnsupportedOperationException();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -531,11 +522,6 @@ public class DeliveryInstructions extends DataStructureImpl {
|
|||||||
throw new RuntimeException("immutable");
|
throw new RuntimeException("immutable");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
|
||||||
out.write((byte) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int writeBytes(byte target[], int offset) {
|
public int writeBytes(byte target[], int offset) {
|
||||||
target[offset] = 0;
|
target[offset] = 0;
|
||||||
|
@ -9,7 +9,6 @@ package net.i2p.data.i2np;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.data.Base64;
|
import net.i2p.data.Base64;
|
||||||
@ -95,16 +94,6 @@ public abstract class FastI2NPMessageImpl extends I2NPMessageImpl {
|
|||||||
return cur - offset;
|
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.
|
* This tests the reuse-checksum feature.
|
||||||
* The results are that mostly UnknownI2NPMessages (from inside a TGM),
|
* The results are that mostly UnknownI2NPMessages (from inside a TGM),
|
||||||
|
@ -101,57 +101,8 @@ public class GarlicClove extends DataStructureImpl {
|
|||||||
* @throws UnsupportedOperationException always
|
* @throws UnsupportedOperationException always
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) {
|
||||||
throw new UnsupportedOperationException();
|
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);
|
|
||||||
****/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,15 +165,11 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
|||||||
* Don't do this if you need a byte array - use toByteArray()
|
* Don't do this if you need a byte array - use toByteArray()
|
||||||
*
|
*
|
||||||
* @deprecated unused
|
* @deprecated unused
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) {
|
||||||
int size = getMessageSize();
|
throw new UnsupportedOperationException();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user