Java Code Examples for java.io.ObjectOutputStream#writeFloat()
The following examples show how to use
java.io.ObjectOutputStream#writeFloat() .
These examples are extracted from open source projects.
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 Project: dragonwell8_jdk File: Floats.java License: 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 2
Source Project: screen-dimmer-pixel-filter File: Cfg.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void Save(Context ctx) { if (!Initialized) { return; } try { ObjectOutputStream out = new ObjectOutputStream(ctx.openFileOutput(SettingsFileName, Context.MODE_PRIVATE)); out.writeInt(Pattern); out.writeInt(ShiftTimeoutIdx); out.writeBoolean(UseLightSensor); out.writeFloat(LightSensorValue); //Log.d(LOG, "cfg: writing pattern " + Pattern + " ShiftTimeoutIdx " + ShiftTimeoutIdx); for (int i = Grids.PatternIdCustom; i < Grids.Patterns.length; i++) { out.write(Grids.Patterns[i]); } out.writeBoolean(true); // Not used anymore out.writeBoolean(true); // Not used anymore out.writeBoolean(WasEnabled); out.writeBoolean(SamsungBacklight); out.writeBoolean(HideNotification); out.writeBoolean(PersistentNotification); out.close(); } catch (Exception e) { Log.e(LOG, "Cannot save config file: " + e); //NON-NLS } }
Example 3
Source Project: jdk8u60 File: Floats.java License: 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 4
Source Project: openjdk-jdk8u File: Floats.java License: 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 5
Source Project: myrrix-recommender File: GenerationSerializer.java License: Apache License 2.0 | 6 votes |
/** * @see #readMatrix(ObjectInputStream) */ private static void writeMatrix(FastByIDMap<float[]> matrix, ObjectOutputStream out) throws IOException { if (matrix == null) { out.writeInt(0); } else { out.writeInt(matrix.size()); for (FastByIDMap.MapEntry<float[]> entry : matrix.entrySet()) { out.writeLong(entry.getKey()); float[] features = entry.getValue(); out.writeInt(features.length); for (float f : features) { Preconditions.checkState(LangUtils.isFinite(f)); out.writeFloat(f); } } } }
Example 6
Source Project: myrrix-recommender File: GenerationSerializer.java License: Apache License 2.0 | 6 votes |
private static void writeClusters(Collection<IDCluster> clusters, ObjectOutputStream out) throws IOException { if (clusters == null) { out.writeInt(0); } else { out.writeInt(clusters.size()); for (IDCluster cluster : clusters) { FastIDSet members = cluster.getMembers(); out.writeInt(members.size()); LongPrimitiveIterator it = members.iterator(); while (it.hasNext()) { out.writeLong(it.nextLong()); } float[] centroid = cluster.getCentroid(); out.writeInt(centroid.length); for (float f : centroid) { out.writeFloat(f); } } } }
Example 7
Source Project: orson-charts File: SerialUtils.java License: GNU General Public License v3.0 | 6 votes |
/** * Serializes a {@code Stroke} object. This code handles the * {@code BasicStroke} class which is the only {@code Stroke} * implementation provided by the JDK (and isn't directly * {@code Serializable}). * * @param stroke the stroke object ({@code null} permitted). * @param stream the output stream ({@code null} not permitted). * * @throws IOException if there is an I/O error. */ public static void writeStroke(Stroke stroke, ObjectOutputStream stream) throws IOException { Args.nullNotPermitted(stream, "stream"); if (stroke != null) { stream.writeBoolean(false); if (stroke instanceof BasicStroke) { BasicStroke s = (BasicStroke) stroke; stream.writeObject(BasicStroke.class); stream.writeFloat(s.getLineWidth()); stream.writeInt(s.getEndCap()); stream.writeInt(s.getLineJoin()); stream.writeFloat(s.getMiterLimit()); stream.writeObject(s.getDashArray()); stream.writeFloat(s.getDashPhase()); } else { stream.writeObject(stroke.getClass()); stream.writeObject(stroke); } } else { stream.writeBoolean(true); } }
Example 8
Source Project: dragonwell8_jdk File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 9
Source Project: openjdk-8 File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 10
Source Project: pentaho-reporting File: GradientPaintSerializer.java License: GNU Lesser General Public License v2.1 | 5 votes |
/** * Writes a serializable object description to the given object output stream. * * @param o the to be serialized object. * @param stream the outputstream that should receive the object. * @throws IOException if an I/O error occured. */ public void writeObject( final Object o, final ObjectOutputStream stream ) throws IOException { final GradientPaint gp = (GradientPaint) o; final Point2D point2D1 = gp.getPoint1(); stream.writeFloat( (float) point2D1.getX() ); stream.writeFloat( (float) point2D1.getY() ); stream.writeObject( gp.getColor1() ); final Point2D point2D = gp.getPoint2(); stream.writeFloat( (float) point2D.getX() ); stream.writeFloat( (float) point2D.getY() ); stream.writeObject( gp.getColor2() ); stream.writeBoolean( gp.isCyclic() ); }
Example 11
Source Project: jdk8u-jdk File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 12
Source Project: openjdk-jdk8u File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 13
Source Project: pentaho-reporting File: BasicStrokeSerializer.java License: GNU Lesser General Public License v2.1 | 5 votes |
/** * Writes a serializable object description to the given object output stream. * * @param o the to be serialized object. * @param stream the outputstream that should receive the object. * @throws IOException if an I/O error occured. */ public void writeObject( final Object o, final ObjectOutputStream stream ) throws IOException { final BasicStroke s = (BasicStroke) o; stream.writeFloat( s.getLineWidth() ); stream.writeInt( s.getEndCap() ); stream.writeInt( s.getLineJoin() ); stream.writeFloat( s.getMiterLimit() ); stream.writeObject( s.getDashArray() ); stream.writeFloat( s.getDashPhase() ); }
Example 14
Source Project: jtransc File: HashSet.java License: Apache License 2.0 | 5 votes |
private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeInt(backingMap.table.length); stream.writeFloat(HashMap.DEFAULT_LOAD_FACTOR); stream.writeInt(size()); for (E e : this) { stream.writeObject(e); } }
Example 15
Source Project: openjdk-jdk9 File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 16
Source Project: hottub File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 17
Source Project: openjdk-8-source File: CustomObjTrees.java License: GNU General Public License v2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(z); out.writeByte(b); out.writeChar(c); out.writeShort(s); out.writeInt(i); out.writeFloat(f); out.writeLong(j); out.writeDouble(d); out.writeObject(str); out.writeObject(parent); out.writeObject(left); out.writeObject(right); }
Example 18
Source Project: jphp File: AbstractHashedMap.java License: Apache License 2.0 | 3 votes |
/** * Writes the map data to 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 serialize the state data of this class in * this protected method. This method must be called by the * <code>writeObject()</code> of the first serializable subclass. * <p/> * Subclasses may override if they have a specific field that must be present * on read before this implementation will work. Generally, the read determines * what must be serialized here, if anything. * * @param out the output stream */ protected void doWriteObject(ObjectOutputStream out) throws IOException { out.writeFloat(loadFactor); out.writeInt(data.length); out.writeInt(size); for (MapIterator it = mapIterator(); it.hasNext();) { out.writeObject(it.next()); out.writeObject(it.getValue()); } }
Example 19
Source Project: weblaf File: AbstractHashMap.java License: GNU General Public License v3.0 | 3 votes |
/** * Writes the map data to 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 serialize the state data of this class in * this protected method. This method must be called by the * {@code writeObject()} of the first serializable subclass. * <p> * Subclasses may override if they have a specific field that must be present * on read before this implementation will work. Generally, the read determines * what must be serialized here, if anything. * * @param out the output stream * @throws IOException if IO operation fails */ @SuppressWarnings ( "NonSerializableObjectPassedToObjectStream" ) protected void doWriteObject ( final ObjectOutputStream out ) throws IOException { out.writeFloat ( loadFactor ); out.writeInt ( data.length ); out.writeInt ( size ); for ( final MapIterator<K, V> it = mapIterator (); it.hasNext (); ) { out.writeObject ( it.next () ); out.writeObject ( it.getValue () ); } }
Example 20
Source Project: AndroidPNClient File: AbstractHashedMap.java License: Apache License 2.0 | 3 votes |
/** * Writes the map data to 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 serialize the state data of this class in * this protected method. This method must be called by the * <code>writeObject()</code> of the first serializable subclass. * <p/> * Subclasses may override if they have a specific field that must be present * on read before this implementation will work. Generally, the read determines * what must be serialized here, if anything. * * @param out the output stream */ protected void doWriteObject(ObjectOutputStream out) throws IOException { out.writeFloat(loadFactor); out.writeInt(data.length); out.writeInt(size); for (MapIterator it = mapIterator(); it.hasNext();) { out.writeObject(it.next()); out.writeObject(it.getValue()); } }