/** * Reads a a float from a buffer. * @param buf the buffer * @return the float read from the buffer */ public static float readFloat(ByteBuffer buf) { return Float.intBitsToFloat(readInt(buf)); }
/** * Reads a a float from an input stream. * @param in the input stream * @return the float read from the input stream */ public static float readFloat(DataInput in) throws IOException { return Float.intBitsToFloat(readInt(in)); }
/** * Reads a a float from an input stream. * @param in the input stream * @return the float read from the input stream */ public static float readFloat(DataInput in) throws IOException { return Float.intBitsToFloat(readInt(in)); }
/** * Reads a a float from a buffer. * @param buf the buffer * @return the float read from the buffer */ public static float readFloat(ByteBuffer buf) { return Float.intBitsToFloat(readInt(buf)); }
/** * Reads a a float from a buffer. * @param buf the buffer * @return the float read from the buffer */ public static float readFloat(ByteBuffer buf) { return Float.intBitsToFloat(readInt(buf)); }
/** * Reads a a float from an input stream. * @param in the input stream * @return the float read from the input stream */ public static float readFloat(DataInput in) throws IOException { return Float.intBitsToFloat(readInt(in)); }
public static float readFloat(byte[] buf, int offset) { return Float.intBitsToFloat(readInt(buf, offset)); }
public static float readFloat(byte[] buf, int offset) { return Float.intBitsToFloat(readInt(buf, offset)); }
public static float readFloat(byte[] buf, int offset) { return Float.intBitsToFloat(readInt(buf, offset)); }
/** * Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte * @param buf the buffer * @return the string read from buf */ public static String readString(ByteBuffer buf) { if(buf.get() == 0) return null; int len=readInt(buf); byte[] bytes=new byte[len]; buf.get(bytes); return new String(bytes); }
/** * Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte * @param buf the buffer * @return the string read from buf */ public static String readString(ByteBuffer buf) { if(buf.get() == 0) return null; int len=readInt(buf); byte[] bytes=new byte[len]; buf.get(bytes); return new String(bytes); }
/** * Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte * @param buf the buffer * @return the string read from buf */ public static String readString(ByteBuffer buf) { if(buf.get() == 0) return null; int len=readInt(buf); byte[] bytes=new byte[len]; buf.get(bytes); return new String(bytes); }
public static <T extends Streamable> T[] read(Class<T> clazz, DataInput in) throws Exception { int size=Bits.readInt(in); if(size == 0) return null; T[] retval=(T[])Array.newInstance(clazz, size); for(int i=0; i < retval.length; i++) { retval[i]=clazz.newInstance(); retval[i].readFrom(in); } return retval; }
public static <T extends Streamable> T[] read(Class<T> clazz, DataInput in) throws Exception { int size=Bits.readInt(in); if(size == 0) return null; T[] retval=(T[])Array.newInstance(clazz, size); for(int i=0; i < retval.length; i++) { retval[i]=clazz.newInstance(); retval[i].readFrom(in); } return retval; }
public static <T extends Streamable> T[] read(Class<T> clazz, DataInput in) throws Exception { int size=Bits.readInt(in); if(size == 0) return null; T[] retval=(T[])Array.newInstance(clazz, size); for(int i=0; i < retval.length; i++) { retval[i]=clazz.newInstance(); retval[i].readFrom(in); } return retval; }
case TYPE_DOUBLE: return (Double)Bits.readDouble(buffer, offset); case TYPE_FLOAT: return (Float)Bits.readFloat(buffer, offset); case TYPE_INT: return (Integer)Bits.readInt(buffer, offset); case TYPE_LONG: return (Long)Bits.readLong(buffer, offset); case TYPE_SHORT: return (Short)Bits.readShort(buffer, offset);
case TYPE_DOUBLE: return (Double)Bits.readDouble(buffer, offset); case TYPE_FLOAT: return (Float)Bits.readFloat(buffer, offset); case TYPE_INT: return (Integer)Bits.readInt(buffer, offset); case TYPE_LONG: return (Long)Bits.readLong(buffer, offset); case TYPE_SHORT: return (Short)Bits.readShort(buffer, offset);
case TYPE_DOUBLE: return (Double)Bits.readDouble(buffer, offset); case TYPE_FLOAT: return (Float)Bits.readFloat(buffer, offset); case TYPE_INT: return (Integer)Bits.readInt(buffer, offset); case TYPE_LONG: return (Long)Bits.readLong(buffer, offset); case TYPE_SHORT: return (Short)Bits.readShort(buffer, offset);