List of usage examples for java.io ObjectInput readFully
void readFully(byte b[], int off, int len) throws IOException;
From source file:ByteArray.java
/** * Read this object from a stream of stored objects. * * @param in read this./*from www . ja va 2 s .c o m*/ * * @exception IOException thrown on error */ public void readExternal(ObjectInput in) throws IOException { int len = length = in.readInt(); offset = 0; array = new byte[len]; in.readFully(array, 0, len); }
From source file:org.apache.axis2.context.externalize.SafeObjectInputStream.java
/** * Get the byte stream for an object that is written using the * byte format. // w w w.j a va 2 s. c o m * EXPECTED format * int (number of bytes) * bytes * * @param in * @return * @throws IOException * @throws ClassNotFoundException */ private ByteArrayInputStream getByteStream(ObjectInput in) throws IOException, ClassNotFoundException { // Read the length int size = in.readInt(); // Fill our temporary buffer if (buffer == null || buffer.length < size) { int allocSize = (size > BUFFER_MIN_SIZE) ? size : BUFFER_MIN_SIZE; buffer = new byte[allocSize]; } in.readFully(buffer, 0, size); // Return a stream backed by the buffer return new ByteArrayInputStream(buffer, 0, size); }
From source file:org.opencms.db.CmsPublishList.java
/** * Reads a UUID from an object input.<p> * //from w ww .j av a2 s. com * @param in the object input * @return a UUID * @throws IOException */ private CmsUUID internalReadUUID(ObjectInput in) throws IOException { byte[] bytes = new byte[UUID_LENGTH]; in.readFully(bytes, 0, UUID_LENGTH); return new CmsUUID(bytes); }