public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(final DataOutput out, final Token token) throws IOException { final long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long)Integer.MAX_VALUE - (long)Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflo idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflow idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }
public void write(DataOutput out, Token token) throws IOException { long id = token.getId(); byte idType; if (id <= Byte.MAX_VALUE - Byte.MIN_VALUE) { idType = ID_ONE_BYTE; } else if (id <= Short.MAX_VALUE - Short.MIN_VALUE) { idType = ID_TWO_BYTES; } else if (id <= (long) Integer.MAX_VALUE - (long) Integer.MIN_VALUE) { // cast to long to prevent overflo idType = ID_FOUR_BYTES; } else { idType = ID_EIGHT_BYTES; } out.write(token.getType() + idType); token.writeTo(out, idType); }