Examples of RecordEnumeration


Examples of javax.microedition.rms.RecordEnumeration

    Font[] fonts = {
        Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL),
        Font.getFont(Font.FACE_SYSTEM, Font.STYLE_UNDERLINED,  Font.SIZE_SMALL),
    };
    int i = 0;
    RecordEnumeration enumeration = rms.enumerateRecords(null, null, false);
    while (enumeration.hasNextElement()) {
      String data = decode(enumeration.nextRecord());
      StringItem item = new StringItem(null, data);
      //#ifndef midp1.0
      item.setFont(fonts[++i % fonts.length]);
      //#endif
      append(item);
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

    try {
      if (fc.exists())
        fc.delete();
      fc.create();
      PrintStream out = new PrintStream(fc.openOutputStream());
      RecordEnumeration enumeration = rms.enumerateRecords(null, null, false);
      while (enumeration.hasNextElement()) {
        String data = decode(enumeration.nextRecord());
        out.print(data);
      }
      out.close();
    } finally {
      fc.close();
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

  }

  public Vector findByYear(final int year) throws RecordStoreException, IOException {
    Vector results = new Vector();
    Calendar cal = Calendar.getInstance();
    RecordEnumeration enumeration = getBaseRMS().enumerateRecords(null, null, false);
    boolean include = false;
    while (enumeration.hasNextElement()) {
      Period period = find(enumeration.nextRecordId());
      include = false;
      cal.setTime(period.getStart());
      if(year == cal.get(Calendar.YEAR))
        include = true;
      cal.setTime(period.getEnd());
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

    return results;
  }

  public Vector findAll() throws RecordStoreException, IOException {
    Vector all = new Vector();
    RecordEnumeration enumeration = getBaseRMS().enumerateRecords(null, null, false);
    while (enumeration.hasNextElement()) {
      all.addElement(find(enumeration.nextRecordId()));
    }
    return all;
  }
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

     */
    public Vector vectFromRS() throws InvalidRecordIDException, IOException, RecordStoreException
    {
        Vector vectOfRS = new Vector(10);
        RecordStore rs = null;
        RecordEnumeration re = null;
        try{
            rs = RecordStore.openRecordStore(rsName, true);
            re = rs.enumerateRecords(null, null, false);

            while(re.hasNextElement())
            {
                textConvo crnt = textConvo.deserialize(re.nextRecord());
                vectOfRS.addElement(crnt);
            }
        }
        finally{
            rs.closeRecordStore();
            re.destroy();
            return vectOfRS;
        }
    }
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

     */
    public Vector vectFromRS() throws InvalidRecordIDException, IOException, RecordStoreException
    {
        Vector vectOfRS = new Vector(10);
        RecordStore rs = null;
        RecordEnumeration re = null;
        try{
            rs = RecordStore.openRecordStore(rsName, true);
            re = rs.enumerateRecords(null, null, false);

            while(re.hasNextElement())
            {
                textConvo crnt = textConvo.deserialize(re.nextRecord());
                vectOfRS.addElement(crnt);
            }
        }
        finally{
            try{
                rs.closeRecordStore();
                re.destroy();
            }
            catch(Exception ignore){}
            return vectOfRS;
        }
    }
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

        Ranking rank = null;
        try {
            _recordId = -1;

            // Find the first available record
            RecordEnumeration re = _rs.enumerateRecords(null, null, false);
            while (re.hasNextElement()) {
                _recordId = re.nextRecordId();
            }

            // If a record was found then load it
            if (_recordId != -1) {
                data = _rs.getRecord(_recordId);
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

     */
    public IRecord getIndex( final ISerializable serializable )
    {
        try
        {
            final RecordEnumeration records = store_.enumerateRecords( null, null, false );
            if( records.hasNextElement() )
                return new Record( store_, serializable, records.nextRecordId() );
            final Record record = new Record( store_, serializable );
            record.persist();
            return record;
        }
        catch( RecordStoreException e )
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

      // size = number of records + 1 for additional root element
      int          nRecords = rRecordStore.getNumRecords() + 1;
      byte[]        aBuf     = null;
      DataInputStream   aIn     = null;
      IntArray      aIDs     = new IntArray(nRecords);
      RecordEnumeration aRecords;

      aRecords   = rRecordStore.enumerateRecords(null, null, false);
      aRecordIDs = new Vector(nRecords);

      // insert first element as a root that is not part of the RecordStore
      aIDs.push(-1);
      aRecordIDs.insertElementAt(new NodeRecordIDs(-1, -1), 0);

      while (aRecords.hasNextElement())
      {
        // read all record IDs and store them in ascending order;
        // this makes sure that children are always behind their parent
        int nID   = aRecords.nextRecordId();
        int nPos  = aIDs.insertAscending(nID, 1);
        int nSize = rRecordStore.getRecordSize(nID);

        if ((aBuf == null) || (aBuf.length < nSize))
        {
          // increase buffer size and (re-)initialize the input stream
          if (aIn != null)
          {
            aIn.close();
          }

          aBuf = new byte[nSize];
          aIn  = new DataInputStream(new ByteArrayInputStream(aBuf));
        }
        else
        {
          aIn.reset();
        }

        // read parent ID
        rRecordStore.getRecord(nID, aBuf, 0);

        int nParent = aIn.readInt();

        aRecordIDs.insertElementAt(new NodeRecordIDs(nID, nParent),
                       nPos);
      }

      if (aIn != null)
      {
        aIn.close();
      }

      aRecords.destroy();
    }

    return aRecordIDs;
  }
View Full Code Here

Examples of javax.microedition.rms.RecordEnumeration

        //logger.debug("printAllRecords begins");
        try {
            filter = null;
            comparator = null;

            RecordEnumeration re_enum = recordStore.enumerateRecords(filter, comparator, true);
            while (re_enum.hasNextElement()) {
                int id = re_enum.nextRecordId();
                ByteArrayInputStream bais = new ByteArrayInputStream(recordStore.getRecord(id));
                DataInputStream inputStream = new DataInputStream(bais);

                try {
                    String s_propID = inputStream.readUTF();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.