Java Code Examples for java.io.ObjectInputStream#readChar()

The following examples show how to use java.io.ObjectInputStream#readChar() . 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: Chars.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 2
Source File: CustomObjTrees.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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 3
Source File: CustomObjTrees.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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: Chars.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 5
Source File: CustomObjTrees.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 6
Source File: Chars.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 7
Source File: CustomObjTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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 8
Source File: Chars.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 9
Source File: CustomObjTrees.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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: Chars.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 11
Source File: CustomObjTrees.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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: Chars.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 13
Source File: CustomObjTrees.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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 14
Source File: CustomObjTrees.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 15
Source File: CustomObjTrees.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 16
Source File: CustomObjTrees.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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 17
Source File: Chars.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.writeChar('0');
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readChar();
        }
    }
}
 
Example 18
Source File: EntityEntryContext.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * JDK serialization hook for deserializing
 *
 * @param ois The stream to read ourselves from
 * @param rtn The persistence context we belong to
 *
 * @return The deserialized EntityEntryContext
 *
 * @throws IOException Indicates an IO exception accessing the given stream
 * @throws ClassNotFoundException Problem reading stream data
 */
public static EntityEntryContext deserialize(ObjectInputStream ois, StatefulPersistenceContext rtn)
		throws IOException, ClassNotFoundException {
	final int count = ois.readInt();
	log.tracef( "Starting deserialization of [%s] EntityEntry entries", count );

	final EntityEntryContext context = new EntityEntryContext( rtn );
	context.count = count;
	context.dirty = true;

	if ( count == 0 ) {
		return context;
	}

	ManagedEntity previous = null;

	for ( int i = 0; i < count; i++ ) {
		final boolean isEnhanced = ois.readBoolean();
		final Object entity = ois.readObject();

		//Call deserialize method dynamically via reflection
		final int numChars = ois.readInt();
		final char[] entityEntryClassNameArr = new char[numChars];
		for ( int j = 0; j < numChars; j++ ) {
			entityEntryClassNameArr[j] = ois.readChar();
		}

		final EntityEntry entry = deserializeEntityEntry( entityEntryClassNameArr, ois, rtn );

		final ManagedEntity managedEntity;
		if ( isEnhanced ) {
			if ( entry.getPersister().isMutable() ) {
				managedEntity = (ManagedEntity) entity;
			}
			else {
				managedEntity = new ImmutableManagedEntityHolder( (ManagedEntity) entity );
				if ( context.immutableManagedEntityXref == null ) {
					context.immutableManagedEntityXref =
							new IdentityHashMap<ManagedEntity, ImmutableManagedEntityHolder>();
				}
				context.immutableManagedEntityXref.put(
						(ManagedEntity) entity,
						(ImmutableManagedEntityHolder) managedEntity

				);
			}
		}
		else {
			managedEntity = new ManagedEntityImpl( entity );
			if ( context.nonEnhancedEntityXref == null ) {
				context.nonEnhancedEntityXref = new IdentityHashMap<Object, ManagedEntity>();
			}
			context.nonEnhancedEntityXref.put( entity, managedEntity );
		}
		managedEntity.$$_hibernate_setEntityEntry( entry );

		if ( previous == null ) {
			context.head = managedEntity;
		}
		else {
			previous.$$_hibernate_setNextManagedEntity( managedEntity );
			managedEntity.$$_hibernate_setPreviousManagedEntity( previous );
		}

		previous = managedEntity;
	}

	context.tail = previous;

	return context;
}
 
Example 19
Source File: MethodInvokedFirstTimeCommand.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
void readObject(ObjectInputStream in) throws IOException {
    methodId = in.readChar();
}
 
Example 20
Source File: MutableString.java    From database with GNU General Public License v2.0 3 votes vote down vote up
/** Reads a mutable string in serialised form. 
   *
   * <P>Mutable strings produced by this method are always compact; this seems
   * reasonable, as stored strings are unlikely going to be changed.
   *
   * <P>Because of limitations of {@link ObjectInputStream}, this method must
   * read one character at a time, and does not try to do any read-ahead (in
   * particular, it does not create any object). On non-buffered data inputs
   * it might be very slow.
   * 
   * @param s a data input.
   */

  private void readObject( final ObjectInputStream s ) throws IOException, ClassNotFoundException {
s.defaultReadObject();
final int length = s.readInt();
// The new string will be compact.
hashLength = -1;
expand( length );
final char[] a = array;
for( int i = 0; i < length; i++ ) a[ i ] = s.readChar();
  }