Java Code Examples for java.io.ObjectInputStream#readFloat()
The following examples show how to use
java.io.ObjectInputStream#readFloat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TFloatMap.java From berkeleyparser with GNU General Public License v2.0 | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { this.mapType = (MapType) in.readObject(); this.num = 0; this.locked = false; int n = in.readInt(); allocate(getCapacity(n, true)); for (int i = 0; i < n; i++) { T key = keyFunc.intern((T) in.readObject()); // CHECKED float value = in.readFloat(); if (mapType == MapType.SORTED_LIST) { // Assume keys and values serialized in sorted order keys[num] = key; values[num] = value; num++; } else if (mapType == MapType.HASH_TABLE) { put(key, value); } } }
Example 2
Source File: Floats.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Run benchmark for given number of batches, with given number of cycles * for each batch. */ void doReps(ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, int nbatches, int ncycles) throws Exception { for (int i = 0; i < nbatches; i++) { sbuf.reset(); for (int j = 0; j < ncycles; j++) { oout.writeFloat((float) 0.0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readFloat(); } } }
Example 3
Source File: CustomObjTrees.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { z = in.readBoolean(); b = in.readByte(); c = in.readChar(); s = in.readShort(); i = in.readInt(); f = in.readFloat(); j = in.readLong(); d = in.readDouble(); str = (String) in.readObject(); parent = in.readObject(); left = in.readObject(); right = in.readObject(); }
Example 4
Source File: CustomObjTrees.java From hottub with GNU General Public License v2.0 | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { z = in.readBoolean(); b = in.readByte(); c = in.readChar(); s = in.readShort(); i = in.readInt(); f = in.readFloat(); j = in.readLong(); d = in.readDouble(); str = (String) in.readObject(); parent = in.readObject(); left = in.readObject(); right = in.readObject(); }
Example 5
Source File: GenerationSerializer.java From myrrix-recommender with Apache License 2.0 | 6 votes |
/** * @see #writeMatrix(FastByIDMap, ObjectOutputStream) */ private static FastByIDMap<float[]> readMatrix(ObjectInputStream in) throws IOException { int count = in.readInt(); FastByIDMap<float[]> matrix = new FastByIDMap<float[]>(count); for (int i = 0; i < count; i++) { long id = in.readLong(); float[] features = new float[in.readInt()]; for (int j = 0; j < features.length; j++) { float f = in.readFloat(); Preconditions.checkState(LangUtils.isFinite(f)); features[j] = f; } matrix.put(id, features); } return matrix; }
Example 6
Source File: CustomObjTrees.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { z = in.readBoolean(); b = in.readByte(); c = in.readChar(); s = in.readShort(); i = in.readInt(); f = in.readFloat(); j = in.readLong(); d = in.readDouble(); str = (String) in.readObject(); parent = in.readObject(); left = in.readObject(); right = in.readObject(); }
Example 7
Source File: Floats.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Run benchmark for given number of batches, with given number of cycles * for each batch. */ void doReps(ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, int nbatches, int ncycles) throws Exception { for (int i = 0; i < nbatches; i++) { sbuf.reset(); for (int j = 0; j < ncycles; j++) { oout.writeFloat((float) 0.0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readFloat(); } } }
Example 8
Source File: Floats.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Run benchmark for given number of batches, with given number of cycles * for each batch. */ void doReps(ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, int nbatches, int ncycles) throws Exception { for (int i = 0; i < nbatches; i++) { sbuf.reset(); for (int j = 0; j < ncycles; j++) { oout.writeFloat((float) 0.0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readFloat(); } } }
Example 9
Source File: Floats.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Run benchmark for given number of batches, with given number of cycles * for each batch. */ void doReps(ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, int nbatches, int ncycles) throws Exception { for (int i = 0; i < nbatches; i++) { sbuf.reset(); for (int j = 0; j < ncycles; j++) { oout.writeFloat((float) 0.0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readFloat(); } } }
Example 10
Source File: TIntFloatHashMap.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { int key = stream.readInt(); float val = stream.readFloat(); put(key, val); } }
Example 11
Source File: TFloatObjectHashMap.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { float key = stream.readFloat(); Object val = stream.readObject(); put(key, val); } }
Example 12
Source File: TFloatIntHashMap.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { float key = stream.readFloat(); int val = stream.readInt(); put(key, val); } }
Example 13
Source File: TDoubleFloatHashMap.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { double key = stream.readDouble(); float val = stream.readFloat(); put(key, val); } }
Example 14
Source File: TFloatHashSet.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { float val = stream.readFloat(); add(val); } }
Example 15
Source File: BasicStrokeSerializer.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Reads the object from the object input stream. * * @param stream the object input stream from where to read the serialized data. * @return the generated object. * @throws IOException if reading the stream failed. * @throws ClassNotFoundException if serialized object class cannot be found. */ public Object readObject( final ObjectInputStream stream ) throws IOException, ClassNotFoundException { final float width = stream.readFloat(); final int cap = stream.readInt(); final int join = stream.readInt(); final float miterLimit = stream.readFloat(); final float[] dash = (float[]) stream.readObject(); final float dashPhase = stream.readFloat(); //noinspection MagicConstant return new BasicStroke( width, cap, join, miterLimit, dash, dashPhase ); }
Example 16
Source File: TFloatDoubleHashMap.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { float key = stream.readFloat(); double val = stream.readDouble(); put(key, val); } }
Example 17
Source File: TFloatLongHashMap.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { float key = stream.readFloat(); long val = stream.readLong(); put(key, val); } }
Example 18
Source File: AbstractHashMap.java From weblaf with GNU General Public License v3.0 | 4 votes |
/** * Reads the map data from the stream. This method must be overridden if a * subclass must be setup before {@code put()} is used. * <p> * Serialization is not one of the JDK's nicest topics. Normal serialization will * initialise the superclass before the subclass. Sometimes however, this isn't * what you want, as in this case the {@code put()} method on read can be * affected by subclass state. * <p> * The solution adopted here is to deserialize the state data of this class in * this protected method. This method must be called by the * {@code readObject()} of the first serializable subclass. * <p> * Subclasses may override if the subclass has a specific field that must be present * before {@code put()} or {@code calculateThreshold()} will work correctly. * * @param in the input stream * @throws IOException if IO operation fails * @throws ClassNotFoundException if unable to resolve object class */ protected void doReadObject ( final ObjectInputStream in ) throws IOException, ClassNotFoundException { loadFactor = in.readFloat (); final int capacity = in.readInt (); final int size = in.readInt (); init (); threshold = calculateThreshold ( capacity, loadFactor ); data = new HashEntry[ capacity ]; for ( int i = 0; i < size; i++ ) { final Object key = in.readObject (); final Object value = in.readObject (); put ( key, value ); } }
Example 19
Source File: AbstractHashedMap.java From AndroidPNClient with Apache License 2.0 | 3 votes |
/** * Reads the map data from the stream. This method must be overridden if a * subclass must be setup before <code>put()</code> is used. * <p/> * Serialization is not one of the JDK's nicest topics. Normal serialization will * initialise the superclass before the subclass. Sometimes however, this isn't * what you want, as in this case the <code>put()</code> method on read can be * affected by subclass state. * <p/> * The solution adopted here is to deserialize the state data of this class in * this protected method. This method must be called by the * <code>readObject()</code> of the first serializable subclass. * <p/> * Subclasses may override if the subclass has a specific field that must be present * before <code>put()</code> or <code>calculateThreshold()</code> will work correctly. * * @param in the input stream */ protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException { loadFactor = in.readFloat(); int capacity = in.readInt(); int size = in.readInt(); init(); data = new HashEntry[capacity]; for (int i = 0; i < size; i++) { K key = (K) in.readObject(); V value = (V) in.readObject(); put(key, value); } threshold = calculateThreshold(data.length, loadFactor); }
Example 20
Source File: AbstractHashedMap.java From jphp with Apache License 2.0 | 3 votes |
/** * Reads the map data from the stream. This method must be overridden if a * subclass must be setup before <code>put()</code> is used. * <p/> * Serialization is not one of the JDK's nicest topics. Normal serialization will * initialise the superclass before the subclass. Sometimes however, this isn't * what you want, as in this case the <code>put()</code> method on read can be * affected by subclass state. * <p/> * The solution adopted here is to deserialize the state data of this class in * this protected method. This method must be called by the * <code>readObject()</code> of the first serializable subclass. * <p/> * Subclasses may override if the subclass has a specific field that must be present * before <code>put()</code> or <code>calculateThreshold()</code> will work correctly. * * @param in the input stream */ protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException { loadFactor = in.readFloat(); int capacity = in.readInt(); int size = in.readInt(); init(); data = new HashEntry[capacity]; for (int i = 0; i < size; i++) { K key = (K) in.readObject(); V value = (V) in.readObject(); put(key, value); } threshold = calculateThreshold(data.length, loadFactor); }