/** * Computes a SHA-1 digest from the hash of the superclass, if there is a superclass, followed * by the name of this class, followed by the name and type for each field, if any, declared by * this class and ordered alphabetically by field name. The first 8 bytes of the digest are * used to form the 64-bit hash value for this type. */ private void computeHash() throws IOException, NoSuchAlgorithmException { hash = 0; MessageDigest md = MessageDigest.getInstance("SHA"); DataOutputStream out = new DataOutputStream( new DigestOutputStream(new OptimizedByteArrayOutputStream(127), md)); out.writeUTF(name); out.flush(); byte[] digest = md.digest(); for (int i = Math.min(8, digest.length); --i >= 0; ) { hash += ((long) (digest[i] & 0xFF)) << (i * 8); } }
/** * Returns a byte array containing the UTF encoding of the given string. */ public static byte[] toUtf(String s) throws UTFDataFormatException { try { OptimizedByteArrayOutputStream bout = new OptimizedByteArrayOutputStream(s.length()); DataOutput dout = new DataOutputStream(bout); dout.writeUTF(s); return bout.toByteArray(); } catch (UTFDataFormatException e) { throw e; } catch (IOException e) { throw new AssertionError(e); } }
MessageDigest md = MessageDigest.getInstance("SHA"); DataOutputStream out = new DataOutputStream( new DigestOutputStream(new OptimizedByteArrayOutputStream(127), md)); if (superclass != null) out.writeLong(superclass.hash);
OptimizedByteArrayOutputStream baos = new OptimizedByteArrayOutputStream(); baos.writeByte(buildFlag()); OutputStream os = baos;
OptimizedByteArrayOutputStream baos = new OptimizedByteArrayOutputStream(); baos.writeByte(buildFlag()); OutputStream os = baos;
return; OptimizedByteArrayOutputStream bByteOut = new OptimizedByteArrayOutputStream(); bByteOut.writeByte(buildFlag()); OptimizedByteArrayOutputStream lByteOut = new OptimizedByteArrayOutputStream(); lByteOut.writeByte(buildFlag()); OutputStream bout = bByteOut;
proxyMarshalledObject = proxyMarshalledInstance.convertToMarshalledObject(); OptimizedByteArrayOutputStream os = new OptimizedByteArrayOutputStream(); MarshalOutputStream oos = new MarshalOutputStream(os, Collections.EMPTY_SET); oos.writeObject(proxy);