public void encodeRawString(final String s, final int sizeToWrite) throws IOException { final byte[] bytes = s.getBytes(); for ( int i = 0; i < sizeToWrite; i++ ) if ( i < bytes.length ) encodeRawChar(bytes[i]); else encodeRawMissingValue(BCF2Type.CHAR); }
public void encodeRawString(final String s, final int sizeToWrite) throws IOException { final byte[] bytes = s.getBytes(); for ( int i = 0; i < sizeToWrite; i++ ) if ( i < bytes.length ) encodeRawChar(bytes[i]); else encodeRawMissingValue(BCF2Type.CHAR); }
@Requires({"s != null", "sizeToWrite >= 0"}) public void encodeRawString(final String s, final int sizeToWrite) throws IOException { final byte[] bytes = s.getBytes(); for ( int i = 0; i < sizeToWrite; i++ ) if ( i < bytes.length ) encodeRawChar(bytes[i]); else encodeRawMissingValue(BCF2Type.CHAR); }
public final void encodeTypedString(final byte[] s) throws IOException { if ( s == null ) encodeType(0, BCF2Type.CHAR); else { encodeType(s.length, BCF2Type.CHAR); for ( int i = 0; i < s.length; i++ ) { encodeRawChar(s[i]); } } }
public final void encodeTypedString(final byte[] s) throws IOException { if ( s == null ) encodeType(0, BCF2Type.CHAR); else { encodeType(s.length, BCF2Type.CHAR); for ( int i = 0; i < s.length; i++ ) { encodeRawChar(s[i]); } } }
@Ensures("encodeStream.size() > old(encodeStream.size())") public final void encodeTypedString(final byte[] s) throws IOException { if ( s == null ) encodeType(0, BCF2Type.CHAR); else { encodeType(s.length, BCF2Type.CHAR); for ( int i = 0; i < s.length; i++ ) { encodeRawChar(s[i]); } } }
public final <T extends Object> void encodeRawValue(final T value, final BCF2Type type) throws IOException { try { if ( value == type.getMissingJavaValue() ) encodeRawMissingValue(type); else { switch (type) { case INT8: case INT16: case INT32: encodeRawBytes((Integer) value, type); break; case FLOAT: encodeRawFloat((Double) value); break; case CHAR: encodeRawChar((Byte) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } } catch ( ClassCastException e ) { throw new ClassCastException("BUG: invalid type cast to " + type + " from " + value); } }
public final <T extends Object> void encodeRawValue(final T value, final BCF2Type type) throws IOException { try { if ( value == type.getMissingJavaValue() ) encodeRawMissingValue(type); else { switch (type) { case INT8: case INT16: case INT32: encodeRawBytes((Integer) value, type); break; case FLOAT: encodeRawFloat((Double) value); break; case CHAR: encodeRawChar((Byte) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } } catch ( ClassCastException e ) { throw new ClassCastException("BUG: invalid type cast to " + type + " from " + value); } }
public final <T extends Object> void encodeRawValue(final T value, final BCF2Type type) throws IOException { try { if ( value == type.getMissingJavaValue() ) encodeRawMissingValue(type); else { switch (type) { case INT8: case INT16: case INT32: encodeRawBytes((Integer) value, type); break; case FLOAT: encodeRawFloat((Double) value); break; case CHAR: encodeRawChar((Byte) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } } catch ( ClassCastException e ) { throw new ClassCastException("BUG: invalid type cast to " + type + " from " + value); } }