Java Code Examples for java.io.ObjectInputStream#readBoolean()
The following examples show how to use
java.io.ObjectInputStream#readBoolean() .
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: SerializableHttpCookie.java From XDroidMvp with MIT License | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String name = (String) in.readObject(); String value = (String) in.readObject(); long expiresAt = in.readLong(); String domain = (String) in.readObject(); String path = (String) in.readObject(); boolean secure = in.readBoolean(); boolean httpOnly = in.readBoolean(); boolean hostOnly = in.readBoolean(); boolean persistent = in.readBoolean(); Cookie.Builder builder = new Cookie.Builder(); builder = builder.name(name); builder = builder.value(value); builder = builder.expiresAt(expiresAt); builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain); builder = builder.path(path); builder = secure ? builder.secure() : builder; builder = httpOnly ? builder.httpOnly() : builder; clientCookie = builder.build(); }
Example 2
Source File: SerializableOkHttpCookies.java From bjnetwork with Apache License 2.0 | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String name = (String) in.readObject(); String value = (String) in.readObject(); long expiresAt = in.readLong(); String domain = (String) in.readObject(); String path = (String) in.readObject(); boolean secure = in.readBoolean(); boolean httpOnly = in.readBoolean(); boolean hostOnly = in.readBoolean(); boolean persistent = in.readBoolean(); Cookie.Builder builder = new Cookie.Builder(); builder = builder.name(name); builder = builder.value(value); builder = builder.expiresAt(expiresAt); builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain); builder = builder.path(path); builder = secure ? builder.secure() : builder; builder = httpOnly ? builder.httpOnly() : builder; clientCookies =builder.build(); }
Example 3
Source File: SerialUtilities.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Reads a <code>Point2D</code> object that has been serialised by the * {@link #writePoint2D(Point2D, ObjectOutputStream)} method. * * @param stream the input stream (<code>null</code> not permitted). * * @return The point object (possibly <code>null</code>). * * @throws IOException if there is an I/O problem. */ public static Point2D readPoint2D(ObjectInputStream stream) throws IOException { if (stream == null) { throw new IllegalArgumentException("Null 'stream' argument."); } Point2D result = null; boolean isNull = stream.readBoolean(); if (!isNull) { double x = stream.readDouble(); double y = stream.readDouble(); result = new Point2D.Double(x, y); } return result; }
Example 4
Source File: Booleans.java From hottub 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.writeBoolean(false); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readBoolean(); } } }
Example 5
Source File: CategoryAxis.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Reads a <code>Map</code> of (<code>Comparable</code>, <code>Paint</code>) * elements from a stream. * * @param in the input stream. * * @return The map. * * @throws IOException * @throws ClassNotFoundException * * @see #writePaintMap(Map, ObjectOutputStream) */ private Map readPaintMap(ObjectInputStream in) throws IOException, ClassNotFoundException { boolean isNull = in.readBoolean(); if (isNull) { return null; } Map result = new HashMap(); int count = in.readInt(); for (int i = 0; i < count; i++) { Comparable category = (Comparable) in.readObject(); Paint paint = SerialUtilities.readPaint(in); result.put(category, paint); } return result; }
Example 6
Source File: TemplatesImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Overrides the default readObject implementation since we decided * it would be cleaner not to serialize the entire tranformer * factory. [ ref bugzilla 12317 ] * We need to check if the user defined class for URIResolver also * implemented Serializable * if yes then we need to deserialize the URIResolver * Fix for bugzilla bug 22438 */ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { SecurityManager security = System.getSecurityManager(); if (security != null){ String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) { ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); throw new UnsupportedOperationException(err.toString()); } } is.defaultReadObject(); if (is.readBoolean()) { _uriResolver = (URIResolver) is.readObject(); } _tfactory = new TransformerFactoryImpl(); }
Example 7
Source File: SerialUtilities.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Reads a <code>Point2D</code> object that has been serialised by the * {@link #writePoint2D(Point2D, ObjectOutputStream)} method. * * @param stream the input stream (<code>null</code> not permitted). * * @return The point object (possibly <code>null</code>). * * @throws IOException if there is an I/O problem. */ public static Point2D readPoint2D(final ObjectInputStream stream) throws IOException { if (stream == null) { throw new IllegalArgumentException("Null 'stream' argument."); } Point2D result = null; final boolean isNull = stream.readBoolean(); if (!isNull) { final double x = stream.readDouble(); final double y = stream.readDouble(); result = new Point2D.Double(x, y); } return result; }
Example 8
Source File: SerializableHttpCookie.java From XDroid-Databinding with MIT License | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String name = (String) in.readObject(); String value = (String) in.readObject(); long expiresAt = in.readLong(); String domain = (String) in.readObject(); String path = (String) in.readObject(); boolean secure = in.readBoolean(); boolean httpOnly = in.readBoolean(); boolean hostOnly = in.readBoolean(); boolean persistent = in.readBoolean(); Cookie.Builder builder = new Cookie.Builder(); builder = builder.name(name); builder = builder.value(value); builder = builder.expiresAt(expiresAt); builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain); builder = builder.path(path); builder = secure ? builder.secure() : builder; builder = httpOnly ? builder.httpOnly() : builder; clientCookie = builder.build(); }
Example 9
Source File: CustomObjTrees.java From TencentKona-8 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 10
Source File: SerializableCookie.java From FastWebView with MIT License | 6 votes |
/** * 从对象流中构建cookie对象 */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String name = (String) in.readObject(); String value = (String) in.readObject(); long expiresAt = in.readLong(); String domain = (String) in.readObject(); String path = (String) in.readObject(); boolean secure = in.readBoolean(); boolean httpOnly = in.readBoolean(); boolean hostOnly = in.readBoolean(); Cookie.Builder builder = new Cookie.Builder() .name(name) .value(value) .expiresAt(expiresAt) .path(path); builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain); builder = secure ? builder.secure() : builder; builder = httpOnly ? builder.httpOnly() : builder; this.clientCookie = builder.build(); }
Example 11
Source File: CustomObjTrees.java From openjdk-8-source 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 12
Source File: InitiateProfilingCommand.java From netbeans with Apache License 2.0 | 6 votes |
void readObject(ObjectInputStream in) throws IOException { instrType = in.readInt(); int len = in.readInt(); classNames = new String[len]; for (int i = 0; i < len; i++) { classNames[i] = in.readUTF().intern(); // Interning is important, since checks are through '==' } instrSpawnedThreads = in.readBoolean(); startProfilingPointsActive = in.readBoolean(); try { profilingPointIDs = (int[]) in.readObject(); profilingPointHandlers = (String[]) in.readObject(); profilingPointInfos = (String[]) in.readObject(); } catch (ClassNotFoundException e) { IOException ioe = new IOException(); ioe.initCause(e); throw ioe; } }
Example 13
Source File: CertificateRevokedException.java From Java8CN with Apache License 2.0 | 5 votes |
/** * Deserialize the {@code CertificateRevokedException} instance. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Read in the non-transient fields // (revocationDate, reason, authority) ois.defaultReadObject(); // Defensively copy the revocation date revocationDate = new Date(revocationDate.getTime()); // Read in the size (number of mappings) of the extensions map // and create the extensions map int size = ois.readInt(); if (size == 0) { extensions = Collections.emptyMap(); } else { extensions = new HashMap<String, Extension>(size); } // Read in the extensions and put the mappings in the extensions map for (int i = 0; i < size; i++) { String oid = (String) ois.readObject(); boolean critical = ois.readBoolean(); int length = ois.readInt(); byte[] extVal = new byte[length]; ois.readFully(extVal); Extension ext = sun.security.x509.Extension.newExtension (new ObjectIdentifier(oid), critical, extVal); extensions.put(oid, ext); } }
Example 14
Source File: CalendarTimerData.java From tomee with Apache License 2.0 | 5 votes |
private void readObject(final ObjectInputStream in) throws IOException { super.doReadObject(in); autoCreated = in.readBoolean(); try { scheduleExpression = ScheduleExpression.class.cast(in.readObject()); } catch (final ClassNotFoundException e) { throw new IOException(e); } }
Example 15
Source File: CertificateRevokedException.java From j2objc with Apache License 2.0 | 5 votes |
/** * Deserialize the {@code CertificateRevokedException} instance. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Read in the non-transient fields // (revocationDate, reason, authority) ois.defaultReadObject(); // Defensively copy the revocation date revocationDate = new Date(revocationDate.getTime()); // Read in the size (number of mappings) of the extensions map // and create the extensions map int size = ois.readInt(); if (size == 0) { extensions = Collections.emptyMap(); } else { extensions = new HashMap<String, Extension>(size); } // Read in the extensions and put the mappings in the extensions map for (int i = 0; i < size; i++) { String oid = (String) ois.readObject(); boolean critical = ois.readBoolean(); int length = ois.readInt(); byte[] extVal = new byte[length]; ois.readFully(extVal); Extension ext = sun.security.x509.Extension.newExtension (new ObjectIdentifier(oid), critical, extVal); extensions.put(oid, ext); } }
Example 16
Source File: DenseArrayOfBooleans.java From morpheus-core with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") /** Custom serialization */ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { final int length = is.readInt(); this.values = new boolean[length]; for (int i=0; i<length; ++i) { values[i] = is.readBoolean(); } }
Example 17
Source File: CSSDataURL.java From ph-css with Apache License 2.0 | 5 votes |
private void readObject (@Nonnull final ObjectInputStream in) throws IOException, ClassNotFoundException { m_aMimeType = (IMimeType) in.readObject (); m_bBase64Encoded = in.readBoolean (); m_aContent = (byte []) in.readObject (); final String sCharsetName = in.readUTF (); m_aCharset = CharsetHelper.getCharsetFromName (sCharsetName); m_sContent = (String) in.readObject (); }
Example 18
Source File: ArrayBase.java From morpheus-core with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") /** Custom serialization */ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { this.type = (Class<T>)is.readObject(); this.style = ArrayStyle.valueOf(is.readUTF()); this.parallel = is.readBoolean(); }
Example 19
Source File: ReflectionFactoryTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void readObject(ObjectInputStream ois) throws IOException { Assert.assertFalse(writeObjectCalled, "readObject called too many times"); readObjectCalled = ois.readBoolean(); }
Example 20
Source File: SerializableCookie.java From SmartChart with Apache License 2.0 | 3 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { Cookie.Builder builder = new Cookie.Builder(); builder.name((String) in.readObject()); builder.value((String) in.readObject()); long expiresAt = in.readLong(); if (expiresAt != NON_VALID_EXPIRES_AT) { builder.expiresAt(expiresAt); } final String domain = (String) in.readObject(); builder.domain(domain); builder.path((String) in.readObject()); if (in.readBoolean()) builder.secure(); if (in.readBoolean()) builder.httpOnly(); if (in.readBoolean()) builder.hostOnlyDomain(domain); cookie = builder.build(); }