Write the OBJ record that is part of image records.
    obj_id      # Object ID number.
509403
def store_obj_image(obj_id)   #:nodoc:
    record      = 0x005D   # Record identifier
    length      = 0x0026   # Bytes to follow

    obj_type    = 0x0008   # Object type (Picture).
    data        = ''       # Record data.

    sub_record  = 0x0000   # Sub-record identifier.
    sub_length  = 0x0000   # Length of sub-record.
    sub_data    = ''       # Data of sub-record.
    options     = 0x6011
    reserved    = 0x0000

    # Add ftCmo (common object data) subobject
    sub_record  = 0x0015   # ftCmo
    sub_length  = 0x0012
    sub_data    = [obj_type, obj_id, options, reserved, reserved, reserved].pack('vvvVVV')
    data        = [sub_record, sub_length].pack('vv') + sub_data

    # Add ftCf (Clipboard format) subobject
    sub_record  = 0x0007   # ftCf
    sub_length  = 0x0002
    sub_data    = [0xFFFF].pack( 'v')
    data        += [sub_record, sub_length].pack('vv') + sub_data

    # Add ftPioGrbit (Picture option flags) subobject
    sub_record  = 0x0008   # ftPioGrbit
    sub_length  = 0x0002
    sub_data    = [0x0001].pack('v')
    data        += [sub_record, sub_length].pack('vv') + sub_data

    # Add ftEnd (end of object) subobject
    sub_record  = 0x0000   # ftNts
    sub_length  = 0x0000
    data        += [sub_record, sub_length].pack('vv')

    # Pack the record.
    header  = [record, length].pack('vv')

    append(header, data)

  end
490220
public static void writeObject(Object object, String fileName) throws DISIException {
        log.info("Writing " + fileName);
        try {
            FileOutputStream fos = new FileOutputStream(fileName);
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(object);
            oos.close();
            fos.close();
        } catch (IOException e) {
            final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
            log.error(errMessage, e);
            throw new DISIException(errMessage, e);
        }
    }
1351210
def write_any( obj )
      write_any_log( obj ,  "Write")
      if stream_position != Position.get(obj).at
        raise "Write #{obj.class}:0x#{obj.object_id.to_s(16)} at 0x#{stream_position.to_s(16)} not #{Position.get(obj)}"
      end
      write_any_out(obj)
      write_any_log( obj ,  "Wrote")
      Position.get(obj)
    end
1200853
def insert_with_id(obj):
    
    if '_id' in obj:
        raise ValueError("object already has '_id' field")

    # add created_at/updated_at on insert
    obj['created_at'] = datetime.datetime.utcnow()
    obj['updated_at'] = obj['created_at']

    if obj['_type'] == 'person' or obj['_type'] == 'legislator':
        collection = db.legislators
        id_type = 'L'
    elif obj['_type'] == 'committee':
        collection = db.committees
        id_type = 'C'
    elif obj['_type'] == 'bill':
        collection = db.bills
        id_type = 'B'
    else:
        raise ValueError("unknown _type for object")

    # get abbr
    abbr = obj[settings.LEVEL_FIELD].upper()

    id_reg = re.compile('^%s%s' % (abbr, id_type))

    # Find the next available _id and insert
    id_prefix = '%s%s' % (abbr, id_type)
    cursor = collection.find({'_id': id_reg}).sort('_id', -1).limit(1)

    try:
        new_id = int(next(cursor)['_id'][len(abbr) + 1:]) + 1
    except StopIteration:
        new_id = 1

    while True:
        if obj['_type'] == 'bill':
            obj['_id'] = '%s%08d' % (id_prefix, new_id)
        else:
            obj['_id'] = '%s%06d' % (id_prefix, new_id)
        obj['_all_ids'] = [obj['_id']]

        if obj['_type'] in ['person', 'legislator']:
            obj['leg_id'] = obj['_id']

        try:
            return collection.insert(obj, safe=True)
        except pymongo.errors.DuplicateKeyError:
            new_id += 1
661680
def record(self, i=0):
        """"""
        f = self.__getFileObj(self.dbf)
        if not self.numRecords:
            self.__dbfHeader()
        i = self.__restrictIndex(i)
        recSize = self.__recordFmt()[1]
        f.seek(0)
        f.seek(self.__dbfHeaderLength() + (i * recSize))
        return self.__record()
339334
def write_object(self, obj, parent=None):
        
        # Transform object
        for transformer in self.object_transformers:
            tmp_object = transformer.transform(obj)
            if tmp_object is not obj:
                obj = tmp_object
                break

        self._writeStruct(">B", 1, (self.TC_OBJECT,))
        cls = obj.get_class()
        self.write_classdesc(cls)

        # Add reference
        self.references.append([])
        logging.debug(
            "*** Adding ref 0x%X for object %s",
            len(self.references) - 1 + self.BASE_REFERENCE_IDX,
            obj,
        )

        all_names = collections.deque()
        all_types = collections.deque()
        tmpcls = cls
        while tmpcls:
            all_names.extendleft(reversed(tmpcls.fields_names))
            all_types.extendleft(reversed(tmpcls.fields_types))
            tmpcls = tmpcls.superclass
        del tmpcls

        logging.debug("<=> Field names: %s", all_names)
        logging.debug("<=> Field types: %s", all_types)

        for field_name, field_type in zip(all_names, all_types):
            try:
                logging.debug(
                    "Writing field %s (%s): %s",
                    field_name,
                    field_type,
                    getattr(obj, field_name),
                )
                self._write_value(field_type, getattr(obj, field_name))
            except AttributeError as ex:
                log_error(
                    "No attribute {0} for object {1}\nDir: {2}".format(
                        ex, repr(obj), dir(obj)
                    )
                )
                raise
        del all_names, all_types

        if (
            cls.flags & self.SC_SERIALIZABLE
            and cls.flags & self.SC_WRITE_METHOD
            or cls.flags & self.SC_EXTERNALIZABLE
            and cls.flags & self.SC_BLOCK_DATA
        ):
            for annotation in obj.annotations:
                log_debug(
                    "Write annotation {0} for {1}".format(repr(annotation), repr(obj))
                )
                if annotation is None:
                    self.write_null()
                else:
                    self.writeObject(annotation)
            self._writeStruct(">B", 1, (self.TC_ENDBLOCKDATA,))
321049
def write(self, oprot):
        '''
        
        '''

        oprot.write_struct_begin('OnlineDatabaseObjectsListItem')

        oprot.write_field_begin(name='detail_href', type=11, id=None)
        oprot.write_string(self.detail_href)
        oprot.write_field_end()

        oprot.write_field_begin(name='record_type', type=11, id=None)
        oprot.write_string(self.record_type)
        oprot.write_field_end()

        oprot.write_field_begin(name='title', type=11, id=None)
        oprot.write_string(self.title)
        oprot.write_field_end()

        if self.thumbnail_url is not None:
            oprot.write_field_begin(name='thumbnail_url', type=11, id=None)
            oprot.write_string(self.thumbnail_url)
            oprot.write_field_end()

        oprot.write_field_stop()

        oprot.write_struct_end()

        return self
437322
def write(object_file, dependent_files)
      db.transaction(false) do |store|
        store[object_file] = dependent_files
      end
    end
185013
def write_to_object(object)
      bundle_name = '.bundle.tmp'
      write_bundle(bundle_name)
      object.write(File.open(bundle_name))
      File.delete(bundle_name)
    end
545831
def _write(self, f):
        """"""
        log.debug("writing ndef record at offset {0}".format(f.tell()))

        record_type = self.type
        record_name = self.name
        record_data = self.data
        
        if record_type == '':
            header_flags = 0; record_name = ''; record_data = ''
        elif record_type.startswith("urn:nfc:wkt:"):
            header_flags = 1; record_type = record_type[12:]
        elif re.match(r'[a-zA-Z0-9-]+/[a-zA-Z0-9-+.]+', record_type):
            header_flags = 2; record_type = record_type
        elif re.match(r'[a-zA-Z][a-zA-Z0-9+-.]*://', record_type):
            header_flags = 3; record_type = record_type
        elif record_type.startswith("urn:nfc:ext:"):
            header_flags = 4; record_type = record_type[12:]
        elif record_type == 'unknown':
            header_flags = 5; record_type = ''
        elif record_type == 'unchanged':
            header_flags = 6; record_type = ''

        type_length = len(record_type)
        data_length = len(record_data)
        name_length = len(record_name)

        if self._message_begin:
            header_flags |= 0x80
        if self._message_end:
            header_flags |= 0x40
        if data_length < 256:
            header_flags |= 0x10
        if name_length > 0:
            header_flags |= 0x08

        if data_length < 256:
            f.write(struct.pack(">BBB", header_flags, type_length, data_length))
        else:
            f.write(struct.pack(">BBL", header_flags, type_length, data_length))
        if name_length > 0:
            f.write(struct.pack(">B", name_length))

        f.write(record_type)
        f.write(record_name)
        f.write(record_data)
864948
def write_spo(sub, prd, obj):
    '''
        
    '''
    rcvtriples.append(make_spo(sub, prd, obj))
1225091
def log(self, obj):
        '''
        
        '''
        entries = self.get()
        entries.append(obj)
        # Only log the last |n| entries if set
        if self._size > 0:
            entries = entries[-self._size:]
        self._write_entries(entries)
1074444
def write_classdesc(self, obj, parent=None):
        
        if obj not in self.references:
            # Add reference
            self.references.append(obj)
            logging.debug(
                "*** Adding ref 0x%X for classdesc %s",
                len(self.references) - 1 + self.BASE_REFERENCE_IDX,
                obj.name,
            )

            self._writeStruct(">B", 1, (self.TC_CLASSDESC,))
            self._writeString(obj.name)
            self._writeStruct(">qB", 1, (obj.serialVersionUID, obj.flags))
            self._writeStruct(">H", 1, (len(obj.fields_names),))

            for field_name, field_type in zip(obj.fields_names, obj.fields_types):
                self._writeStruct(">B", 1, (self._convert_type_to_char(field_type),))
                self._writeString(field_name)
                if field_type[0] in (self.TYPE_OBJECT, self.TYPE_ARRAY):
                    try:
                        idx = self.references.index(field_type)
                    except ValueError:
                        # First appearance of the type
                        self.references.append(field_type)
                        logging.debug(
                            "*** Adding ref 0x%X for field type %s",
                            len(self.references) - 1 + self.BASE_REFERENCE_IDX,
                            field_type,
                        )

                        self.write_string(field_type, False)
                    else:
                        # Write a reference to the previous type
                        logging.debug(
                            "*** Reusing ref 0x%X for %s (%s)",
                            idx + self.BASE_REFERENCE_IDX,
                            field_type,
                            field_name,
                        )
                        self.write_reference(idx)

            self._writeStruct(">B", 1, (self.TC_ENDBLOCKDATA,))
            if obj.superclass:
                self.write_classdesc(obj.superclass)
            else:
                self.write_null()
        else:
            # Use reference
            self.write_reference(self.references.index(obj))
1008550
public JBBPTextWriter Obj(final int objId, final Object... obj) throws IOException {
    if (this.extras.isEmpty()) {
      throw new IllegalStateException("There is not any registered extras");
    }

    for (final Object c : obj) {
      String str = null;
      for (final Extra e : this.extras) {
        str = e.doConvertObjToStr(this, objId, c);
        if (str != null) {
          break;
        }
      }

      if (str != null) {
        ensureValueMode();
        printValueString(str);
      }
    }
    return this;
  }
63953
def writeObject(self, obj):
        
        log_debug("Writing object of type {0}".format(type(obj).__name__))
        if isinstance(obj, JavaArray):
            # Deserialized Java array
            self.write_array(obj)
        elif isinstance(obj, JavaEnum):
            # Deserialized Java Enum
            self.write_enum(obj)
        elif isinstance(obj, JavaObject):
            # Deserialized Java object
            self.write_object(obj)
        elif isinstance(obj, JavaString):
            # Deserialized String
            self.write_string(obj)
        elif isinstance(obj, JavaClass):
            # Java class
            self.write_class(obj)
        elif obj is None:
            # Null
            self.write_null()
        elif type(obj) is str:
            # String value
            self.write_blockdata(obj)
        else:
            # Unhandled type
            raise RuntimeError(
                "Object serialization of type {0} is not "
                "supported.".format(type(obj))
            )
731093
def wrap( obj )
      ptr = FFI::MemoryPointer.new( :uint64 )
      ptr.write_uint64( obj.object_id )
      ptr
    end
1147348
def write_record(fo, datum, schema):
    """"""
    for field in schema['fields']:
        name = field['name']
        if name not in datum and 'default' not in field and \
                'null' not in field['type']:
            raise ValueError('no value and no default for %s' % name)
        write_data(fo, datum.get(
            name, field.get('default')), field['type'])