@Override public void save(@NotNull DataOutput out, PsiJavaFileStub value) throws IOException { BufferExposingByteArrayOutputStream buffer = new BufferExposingByteArrayOutputStream(); mySerializer.serialize(value, buffer); out.writeInt(buffer.size()); out.write(buffer.getInternalBuffer(), 0, buffer.size()); }
@Override public PsiJavaFileStub read(@NotNull DataInput in) throws IOException { try { byte[] buffer = new byte[in.readInt()]; in.readFully(buffer); return (PsiJavaFileStub) mySerializer.deserialize(new ByteArrayInputStream(buffer)); } catch (SerializerNotFoundException e) { throw new IOException(e); } }