Java Code Examples for java.io.ObjectInputStream#readLong()
The following examples show how to use
java.io.ObjectInputStream#readLong() .
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: openjdk-8-source File: CustomObjTrees.java License: 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 2
Source Project: jdk8u_jdk File: CustomObjTrees.java License: 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 3
Source Project: morpheus-core File: MappedArrayOfZonedDateTimes.java License: Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") /** Custom serialization */ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { this.file = MappedArrayConstructor.randomFile(true); this.length = is.readInt(); this.defaultValueAsLong = is.readLong(); this.defaultZoneId = is.readShort(); this.defaultValue = (ZonedDateTime)is.readObject(); this.channel = new RandomAccessFile(file, "rw").getChannel(); this.byteBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, BYTE_COUNT * length); for (int i=0; i<length; ++i) { final int byteIndex = i * BYTE_COUNT; final long epochMillis = is.readLong(); final short zoneId = is.readShort(); this.byteBuffer.putLong(byteIndex, epochMillis); this.byteBuffer.putShort(byteIndex + 8, zoneId); } }
Example 4
Source Project: pentaho-reporting File: Element.java License: GNU Lesser General Public License v2.1 | 6 votes |
/** * A helper method that deserializes a object from the given stream. * * @param stream * the stream from which to read the object data. * @throws IOException * if an IO error occured. * @throws ClassNotFoundException * if an referenced class cannot be found. */ private void readObject( final ObjectInputStream stream ) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.attributes = new ReportAttributeMap<Object>( stream.readLong() ); final String[] nameSpaces = (String[]) stream.readObject(); for ( int i = 0; i < nameSpaces.length; i++ ) { final String nameSpace = nameSpaces[i]; final String[] names = (String[]) stream.readObject(); for ( int j = 0; j < names.length; j++ ) { final String name = names[j]; final int nullHandler = stream.readByte(); if ( nullHandler == 0 ) { final Object attribute = SerializerHelper.getInstance().readObject( stream ); this.attributes.setAttribute( nameSpace, name, attribute ); } } } }
Example 5
Source Project: jdk8u-jdk File: Longs.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.writeLong(0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readLong(); } } }
Example 6
Source Project: chaoli-forum-for-android-2 File: SerializableOkHttpCookies.java License: GNU General Public License v3.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 7
Source Project: jdk8u60 File: Longs.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.writeLong(0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readLong(); } } }
Example 8
Source Project: openjdk-jdk8u File: Longs.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.writeLong(0); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readLong(); } } }
Example 9
Source Project: jdk8u-jdk File: CustomObjTrees.java License: 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 Project: openjdk-jdk8u File: CustomObjTrees.java License: 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 11
Source Project: okhttp-OkGo File: SerializableCookie.java License: Apache License 2.0 | 6 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); 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 12
Source Project: rtg-tools File: IntArray.java License: BSD 2-Clause "Simplified" License | 5 votes |
/** * Should only be called from {@link IntCreate#loadIndex(java.io.ObjectInputStream)} * @param ois stream to load from * @return index loaded from stream * @throws IOException if an IO error occurs */ public static IntArray loadIndex(ObjectInputStream ois) throws IOException { final long length = ois.readLong(); final int[] data; try { data = (int[]) ois.readObject(); } catch (ClassNotFoundException e) { throw new IOException("Unrecognized index type", e); } return new IntArray(data, length); }
Example 13
Source Project: gemfirexd-oss File: TLongDoubleHashMap.java License: 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) { long key = stream.readLong(); double val = stream.readDouble(); put(key, val); } }
Example 14
Source Project: timely File: WrappedGorillaCompressor.java License: Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { closed = true; numEntries = in.readLong(); oldestTimestamp = in.readLong(); newestTimestamp = in.readLong(); int length = in.readInt(); backingArray = new long[length]; for (int x = 0; x < length; x++) { backingArray[x] = in.readLong(); } }
Example 15
Source Project: Kettle File: LongObjectHashMap.java License: GNU General Public License v3.0 | 5 votes |
private void readObject(ObjectInputStream inputStream) throws ClassNotFoundException, IOException { inputStream.defaultReadObject(); initialize(); while (true) { long key = inputStream.readLong(); V value = (V) inputStream.readObject(); if (key == EMPTY_KEY && value == null) { break; } put(key, value); } }
Example 16
Source Project: kogito-runtimes File: InputStreamMarkResetTest.java License: Apache License 2.0 | 5 votes |
@Test public void basicReadAndWriteObjectTest() throws Exception { DataObject thingy = new DataObject(); thingy.type = 'a'; thingy.time = new Date().getTime(); thingy.strCount = "1"; byte [] bytes = marshallThingy(thingy); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); BufferedInputStream bis = new BufferedInputStream(bais); ObjectInputStream stream = new ObjectInputStream(bis); DataObject unmaThingy = new DataObject(); unmaThingy.type = stream.readChar(); unmaThingy.time = stream.readLong(); assertTrue( bis.markSupported(), "Mark/reset is not supported" ); bis.mark(8); int [] intBytes = new int [4]; intBytes[0] = bis.read(); intBytes[1] = bis.read(); intBytes[2] = bis.read(); intBytes[3] = bis.read(); if ((intBytes[0] | intBytes[1] | intBytes[2] | intBytes[3] ) < 0) { bis.reset(); } unmaThingy.strCount = stream.readUTF(); assertTrue( thingy.equals(unmaThingy) ); }
Example 17
Source Project: gemfirexd-oss File: TLongHashSet.java License: 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) { long val = stream.readLong(); add(val); } }
Example 18
Source Project: Java8CN File: Date.java License: Apache License 2.0 | 4 votes |
/** * Reconstitute this object from a stream (i.e., deserialize it). */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { fastTime = s.readLong(); }
Example 19
Source Project: netbeans File: MonitoredNumbersResponse.java License: Apache License 2.0 | 4 votes |
void readObject(ObjectInputStream in) throws IOException { int arrSize; mode = in.readInt(); for (int i = 0; i < generalNumbers.length; i++) { generalNumbers[i] = in.readLong(); } if (mode == CommonConstants.MODE_THREADS_SAMPLING) { nThreads = in.readInt(); nThreadStates = in.readInt(); if (threadIds.length < nThreads) { threadIds = new int[nThreads]; } if (stateTimestamps.length < nThreadStates) { stateTimestamps = new long[nThreadStates]; } int len = nThreads * nThreadStates; if (threadStates.length < len) { threadStates = new byte[len]; } for (int i = 0; i < nThreads; i++) { threadIds[i] = in.readInt(); } for (int i = 0; i < nThreadStates; i++) { stateTimestamps[i] = in.readLong(); } in.readFully(threadStates, 0, len); } else if (mode == CommonConstants.MODE_THREADS_EXACT) { int exactLen = in.readInt(); exactThreadIds = new int[exactLen]; exactThreadStates = new byte[exactLen]; exactTimeStamps = new long[exactLen]; for (int i = 0; i < exactLen; i++) { exactThreadIds[i] = in.readInt(); exactThreadStates[i] = in.readByte(); exactTimeStamps[i] = in.readLong(); } } nNewThreads = in.readInt(); if (nNewThreads > 0) { if ((newThreadIds == null) || (newThreadIds.length < nNewThreads)) { newThreadIds = new int[nNewThreads]; newThreadNames = new String[nNewThreads]; newThreadClassNames = new String[nNewThreads]; } for (int i = 0; i < nNewThreads; i++) { newThreadIds[i] = in.readInt(); newThreadNames[i] = in.readUTF(); newThreadClassNames[i] = in.readUTF(); } } arrSize = in.readInt(); gcStarts = new long[arrSize]; for (int i = 0; i < arrSize; i++) { gcStarts[i] = in.readLong(); } arrSize = in.readInt(); gcFinishs = new long[arrSize]; for (int i = 0; i < arrSize; i++) { gcFinishs[i] = in.readLong(); } Arrays.sort(gcStarts); Arrays.sort(gcFinishs); serverState = in.readInt(); serverProgress = in.readInt(); }
Example 20
Source Project: jdk8u60 File: Date.java License: GNU General Public License v2.0 | 4 votes |
/** * Reconstitute this object from a stream (i.e., deserialize it). */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { fastTime = s.readLong(); }