public long save(){
  if (m_isSaved) {
    throw new IllegalStateException(ERR_ALREADY_SAVED);
  }
  if (m_store == null) {
    return 0;
  }
  if (m_count == 0) {
    m_isSaved=true;
    return 0;
  }
  int addr=(int)m_store.alloc(m_buf,m_count,m_context);
  if (m_blobHeader != null) {
    try {
      m_writingHdr=true;
      m_blobHeader.add(addr);
      m_count=0;
      try {
        final int hdrBufSize=4 * (m_blobHeader.size() + 1);
        final ByteArrayOutputStream hdrbuf=new ByteArrayOutputStream(hdrBufSize);
        final DataOutputStream hdrout=new DataOutputStream(hdrbuf);
        hdrout.writeInt(m_blobHeader.size());
        for (int i=0; i < m_blobHeader.size(); i++) {
          hdrout.writeInt(m_blobHeader.get(i));
        }
        hdrout.flush();
        final byte[] outbuf=hdrbuf.toByteArray();
        addr=(int)m_store.alloc(outbuf,hdrBufSize,m_context);
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  finally {
      m_writingHdr=false;
    }
  }
  m_isSaved=true;
  return addr;
}

public long save ( ) { if ( m_isSaved ) { throw new IllegalStateException ( ERR_ALREADY_SAVED ) ; } if ( m_store == null ) { return 0 ; } if ( m_count == 0 ) { m_isSaved = true ; return 0 ; } int addr = ( int ) m_store . alloc ( m_buf , m_count , m_context ) ; if ( m_blobHeader != null ) { try { m_writingHdr = true ; m_blobHeader . add ( addr ) ; m_count = 0 ; try { final int hdrBufSize = 4 * ( m_blobHeader . size ( ) + 1 ) ; final ByteArrayOutputStream hdrbuf = new ByteArrayOutputStream ( hdrBufSize ) ; final DataOutputStream hdrout = new DataOutputStream ( hdrbuf ) ; hdrout . writeInt ( m_blobHeader . size ( ) ) ; for ( int i = 0 ; i < m_blobHeader . size ( ) ; i ++ ) { hdrout . writeInt ( m_blobHeader . get ( i ) ) ; } hdrout . flush ( ) ; final byte [ ] outbuf = hdrbuf . toByteArray ( ) ; addr = ( int ) m_store . alloc ( outbuf , hdrBufSize , m_context ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } finally { m_writingHdr = false ; } } m_isSaved = true ; return addr ; }
on save ( ) the current buffer is allocated and written to the store , and the address of its location returned if saving as blob then addr must index to the bloballocator that then points to the blobheader
