Get all object using RandomAccessFile

hi friends,
i have one log file and this log file contain some object. and i am used Serializable Interface.
i know basically object are not readable format, but consider log file(logInfo.log) contain some object like:
12 javasun
20 sunjava
38 java
96 sun
like wise
am using RandomAccessFile class and this my
raf.writeInt(baos.size());
raf.write(baos.toByteArray());
raf.seek(0);
int a = 0;
while(true)
a = raf.readInt();
System.out.println("The pointer Value : " + a);
byte[] b = new byte[a+4];
int x=(int)raf.getFilePointer();
System.out.println("file Pointer : " + x);
raf.read(b,x,a);
ByteArrayInputStream bais = new ByteArrayInputStream(b,x,a);
ObjectInputStream ois = new ObjectInputStream(bais);
Record rec = (Record)ois.readObject(); //here record is object
System.out.println("The object : "+rec.getAttributes());
using this code i got below result
12 javasun
but i can't get all object from the file(logInfo.log)
how can i get all object? help me!!!...
Thank You

ok, sir
i tried and i got all object from the file. Thank
you,
and,
if i need last two object from file(logInfo.log)
like
38 java
96 sun
how can i get? please give some clue or code
Thank youSince you don't have a set size for the objects, then you will have to read through the entire file always keeping the last two objects, and as soon as the read fails return them.
As I said in your first thread, however, you would be much better off writing the objects with a set size (i.e. calling ByteArrayOutputStream(size) with a single max size rather than ByteArrayOutputStream( ) ) as you would then be able to use seek adding 4 (for the int) to size and multiplying by the position of the recordset you want to read (0 for the first). You would then, also be able to overwrite records and the such (which is the usually one of the main reasons for using something like RandomAccessFile, i.e. creating a Flat DB-Like File).
Edit:
And you would probably lose the int, then anyway (when using a set size), as it wouldn't be needed.

Similar Messages

  • Display all objects used in a program

    Hi guys,
    i want to create a Zprogram to Display all objects used in a program.
    is there any class that can help me plzzz.
    CL_WB_PGEDITOR
    CL_WB_TBEDITOR.
    CL_WB_EDITOR.....
    thks

    Hi Oubaha,
    You can use SE80 to display objects used by a program.
    Regards,
    Chester

  • Need to get IRole object using Roles Display Name

    Hi,
    I need to get IRole object using Roles Display Name. I had the below code in EP 2004 SP12 and it works. But the same code dont work in EP 2004s SP13
    user = request.getUser();
    profile = request.getComponentContext().getProfile();     
    String strRoles = profile.getProperty("Roles");
    String strRole[] = strRoles.split(",");
    IRoleFactory roleFactory = UMFactory.getRoleFactory();
    String roleUniqueId = null;
    int i = 0;
    boolean flagRedirect = false;
    for(i = 0; i < strRole.length; i++){
         try
              com.sap.security.api.IRole role = roleFactory.getRoleByUniqueName(strRole<i>);
              roleUniqueId = role.getUniqueID();
              if(!user.isMemberOfRole(roleUniqueId, true))
                   continue;
              flagRedirect = true;                    
              break;
         catch(UMException ex)
         catch(IOException ex)
    if(!flagRedirect){
    Where property Roles will have comma separated roles display names like "com.ABC.ortho_reports,com.ABC.lawns_ortho_reports,com.ABC.executive_reports"
    Please advise.

    Thanks Mrudula for the response. Sorry for the delay in responding.
    I get UMEException with the message "Role with uniqueName com.ABC.general not found"
    But it works fine if i specify Role unique role (like pcd:portal_content/com.abc.Marketing_Workbench/com.abc.Roles/com.abc.general).
    We are in the process of upgrading Portal environment from EP6.0 SP12 to EP7.0 SP13. Above scenario works fine in the older environment.

  • How to get all records using Invoke-webrequest?/Why Invoke-webrequest returns only first 2000 Records?

    invoke-webrequest content returning only 2000 records though it has around 4000 records in web api.
    The same url if I give in excel oData Data feed I am getting all the records.
    See the below script
    Script:
    $QueryResult= (Invoke-WebRequest -Uri $ODataURI -UseDefaultCredentials)
    [xml]$xmlResult=$QueryResult.content
    foreach($obj in $xmlResult.feed.entry.content.properties)
    $Name=$obj.Name;
    $IsAvail=$obj.isAvail.'#text';
    $PGroup=$obj.PGroup
    I am exporting the above result as a CSV file and my CSV file contains only 2000 records. 
    But,  $xmlResult.feed.Count --> it Shows 4000 Records.
    The same Odata url if I give in excel oData Data feed I am getting all the 4000 records.
    So Please help me how can I get all the records using power shell.
    Thanks
    A Pathfinder..
    JoSwa
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Hi Jo Swa(K.P.Elayaraja)-MCP,
    Would you please also post code which is used to export the records?
    In addition, to use the cmdlet invoke-RestMethod to work on ODate feeds, please refer to this article:
    Interacting with TechEd NA 2012 Schedule using PowerShell v3
    I hope this helps.

  • Get All products using RQL

    Dears,
    how can i get a list of all products using RQL or any other ways ?

    If you're looking for the RQL for dyn/admin, it would be:
    <query-items item-descriptor="product">ALL</query-items>
    If you're looking for the code version, it would be something like this:
    RepositoryView view = repository.getView("product");
    RqlStatement statement = RqlStatement.parseRqlStatement("ALL");
    RepositoryItem[] items = statement.executeQuery (view, null);
    I would just be careful about doing this if you have a large catalog.
    Thanks,
    Joe

  • Getting an object using madataService.getItem()

    i can't get an item using
    maDataService.getItem({itemId:valueId})
    i'm using Flex and Hibernate ,i can get collection using
    maDataService.fill() but i don't know what's wrong with getItem().
    what can be wrong ?
    thx

    userList is a collection of Strings, yes?
    <c:set var="user" scope="session">${userList[2]}</c:set>This sets user equal to a member of that list, a string.
    first name: <c:out value="${user.firstName}"/>You're calling user.firstName - there is no firstName member of string...
    If you want to send a bunch of strings to your view and do the same thing with all of them, put them in a list and iterate over them.
    If you want to send data on a bunch of users and do the same thing with each group of information, I'd recommend creating a class to represent the data for each user, sending a list of those to your view, and iterating over them.
    If you just want to send firstName, lastName, middleName, anotherName to the view and do different things with each of them, don't pack them in a list - just send them as standalone strings and do what you will.
    Hope this helps!
    - Kyle

  • Not getting all objects with Universe connection

    I am using CR 2008 SP2 and I am trying to create my first report using a Universe as the connection.  I click on Blank Report and it opens the Database Expert.  I then open Universes under Create New Connection and the Universe that I want to connect to is there but when I double click on it to create my query I am not seeing all of my Dimensions and Measures.  This is a small Universe with three classes.  The first class has 6 dimensions in it.  The second class has two dimensions in it of which these are date dimensions and then my third dimension is my Measures dimension that has 4 measures.
    I only see 5 of my 6 dimensions from the first class.  I see both of my date dimensions from my date class but I only see one of my measures from my measure class.  When I create a new WEBI report connecting to this universe i get everything as expected.
    Any ideas?

    Hi Ron,
    Since you are using WebI Rich Client of Edge version I assume you are not using a CMS (you are not required to login when you start WRC). Is this correct ?  if so then you might need to make sure your WRC hits the appropriate folder of universes. This can be configured from menu Tools -> Options -> General tab,  where you can define a default folder for universes. Make sure you point to the folder where your latest version of universes are (locally or on a remote machine). Your WRC will always load the version of universe that is stored in that folder.
    Hope this helps
    Abdellatif Astito
    SAP Business Objects

  • How to get list of custom objects used in abap report program?

    Hi friends,
    I have a requirement in which I have to scan the entire abap report and retrieve list of custom objects used in it for example custom tables, data elements, structures, table types etc,. Is there any provision in SAP like fuction modules to do this functionality?  As of now I am coding everything manually where so many possibilities are there for all kinds of objects. Provide your answers and suggestions...
    Thanks,
    Nastera

    Hi,
    The best way to do this is environment analysis. Follow the steps:
    1. Open se38, type in the program name (don't click on on display/change or create button, stay on first screen only)
    2. Click on environment analysis button (hot key SHIFT+F4)
    3. It will throw a pop-up, which will ask for type of object you want to see, which are linked /used by this program. select all (or may be if you are only interested in Tables, then select table only)
    4. Hit 'Enter'
    You will get the full list of all objects used in this report program. Just note down the one which starts with Z or Y and that's it.
    Cheers,
    Anid

  • For an Org Unit, how do we get all Reporting Org units (Also employees reporting to the sub org unit) & Employees ?

    Hi Experts,
    I have a very common requirement in SAP HCM ABAP development.
    For an Org Unit, how do we get all Reporting Org units(Also employees reporting to the sub org unit) & Employees ?
    I have tried using RH_STRUC_GET_MULTIPLE_ROOTS and RHPH_STRUCTURE_READ, but the evaluation path is insufficient to get all objects under it. I tried with both O-S-P and O-O-S-P evaluation paths and as per some constraints, I can’t create a customized evaluation path for a reason.
    I am using PNPCE database for user selection screen and user would be advising the Org unit. I even referred the standard transaction ‘S_AHR_61016495’ which is using PCH logical database.
    I would really appreciate if anyone could provide a solution for this. (Rewards guranteed )
    Kindly help.
    Thank you.
    Regards,
    Mahesh Konade

    Hi Alexandre,
    Although I could not respond in time, thank you so much for your prompt reply.
    I had used the same RHPH_STRUCTURE_READ and passed the appropriate values to it, but it did not populate the required results. I cross checked the results manually, may be some relations issue. But later I tried using RH_STRUC_GET_MULTIPLE_ROOTS and it worked fine.
    Meanwhile I had done a workaround with PCH and RH_STRUC_GET and it served the purpose of getting all the Org units, it’s reporting sub-org-units, positions and persons (The deepest structure from the root org unit advised on selection screen).
    The solution I used is, I captured the org-units advised on selection screen by user using PCH logical database and then by looping on sub-org units reporting to the main org-unit I populated related positions and persons holding them and assigned it to the PNPCE logical database.
    Thank you so much for the help.
    Regards,
    Mahesh Konade

  • Core Data: Get Managed Object by unique part of the objectID

    In my Core Data application, I need to get the pointers to different managed objects whose CoreData objectIDs end with the number I provide. e.g.:
    Get the Person object whose objectID ends with unique number 317. The whole ID is:
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Person/p317>
    or I need to get Department object, which ends with 5; again full ID is:
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Department/p5>
    These numbers are actually primary keys in the SQLite database's tables and I can see them if I open the database directly with sqlite3, and I can of course select the records using SQL query;
    *but I can not figure out how to get these objects using CoreData. I guess I should create the NSPredicate for the fetch request; but I don't know how to write the predicate which will give me the exact object based on the unique part of the objectID*
    As I understand, objectIDs are not object's "normal" attributes.
    Please help. Thanks in advance.

    etresoft wrote:
    DavidMan wrote:
    *but I can not figure out how to get these objects using CoreData. I guess I should create the NSPredicate for the fetch request; but I don't know how to write the predicate which will give me the exact object based on the unique part of the objectID*
    I think you are supposed to consider the entire ID to be unique. You can retrieve the associated object using "objectWithID:" from NSManagedObjectContext.
    The problem is that I am parsing the text from another application and I have only the "unique part" at hand and not the whole objectID. So, I need to cope with that.
    What I see is that the IDs of every entity start with the same text, e.g. here are the IDs of two different entities:
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Person/p317>
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Department/p5>
    As you see, the difference is only in the end, after the entity names "Paper" and "Department". But this is my case and I am not completely sure that this will hold true for EVERY future installation on any system for every entity.
    *Question: will the part like <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A be constant for the particular installation, for every entity/object?*
    If YES, then I will:
    - after getting any/first object, extract the non-unique part, i.e. <x-coredata...749A which is the same for every object in this particular installation on this particular computer
    - get the unique part, i.e. /Person/p317, /Person/p23, /Department/p5 etc.
    - synthesize the "real ID" by appending these two strings
    - ask managedObjectContext to return the object with this ID
    - continue with the acquired object
    How does it sound? Will this work on other computers?
    P.S. FYI: the coredata of this program has only one store i.e. all the data are stored in single sqlite file.

  • BI content report - overview of all objects created in Integrated Planner

    Hi.....we need to create a report containing an overview of all objects used in Integrated Planner. Do we have any standard BI content query or WAB application that meets our requirement? Please let me know whether any multiproviders exists for the same which i can use to create reports.
    Some of the tables involved are:
    RSPLS_ALVL
    RSPLS_ALVL_IOBJ
    RSPLS_ALVLT
    RSPLS_CR_STEPS
    RSPLS_SEQUENCE
    RSPLS_SEQUENCE_S
    RSPLS_SEQUENCET
    RSZELTDIR
    RSRREPDIR
    RSZCOMPDIR
    RSZELTTXT
    thanks,
    Lokesh Nandula

    hi.. try dragging in the currency field corresponding to the amount also in row/column

  • Get list urls using powershell

    Hi all,
    I used below url to get all lists using powershell.
    http://sharepointrelated.com/2011/11/28/get-all-sharepoint-lists-by-using-powershell/
    But i wanted to retrieve all urls of a lists using powershell.Can any one please help.
    Regards,
    Praveen

    This will loop through all the lists and give you the output of the URL:
    $SPWeb = Get-SPWeb "http://sitecollection"
    $List = $SPWeb.Lists
    foreach($i in $List)
    $i.DefaultView.Url
    You could also do this:
    $SPWeb = Get-SPWeb "http://SiteCollention"
    $List = $SPWeb.Lists
    foreach($i in $List)
    $b = $i.DefaultView.Url
    $a = "http://SiteCollention" + "/" + $b
    write-host $a
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

  • How to get all previous versions page contents of a publishing page using SharePoint Client Object Model 2010

    How to get all previous versions page contents and other field values of a publishing page using SharePoint Client Object Model 2010?
    Thanks,
    Osmita

    Hi Osmita,
    Greetings.
    Here are the links that helps you. It has code attached to it.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/a0d2ab40-99ba-4368-8505-1dc559ef6469/get-content-of-previous-version-of-page-sharepoint-2010?forum=sharepointgeneralprevious
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/faaf419f-997e-4150-9911-48cc375c3b46/how-to-get-previous-published-versions-of-publishing-pages-in-sharepoint-2010?forum=sharepointdevelopmentprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • To get all the objects that are used inside the class

    Hi All,
    All i wanna know is to get all the objects that are used inside the class.
    Ex :
    Class A{
    Emp e;
    public add(Dept d){
    e.deptid = d.deptId;
    in this class i have two objects, one Emp obj and another Dept object.
    I wanna get the details abt this class Emp and Dept by simply parsing the file and by not loading this class in JVM.
    Could any pls hel me out.??
    thx.

    I wanna get the details abt this class Emp and Dept
    by simply parsing the file and by not loading this
    class in JVM.Your problem statement is vague and the constraint is IMO hypothetical.

  • Get All Values From NewForm.aspx using Event Receiver Item Adding

    HI All,
             I have conditions to check before the insertion of "Calendar Event".For this I am using Item Adding Event Receiver ,When Click on Save button I need to get all the values of Items filled in NewForm.aspx and check
    the condition,If condition satisfies make them insert else show alert info  as"Not Valid",Below is code and error message
    public override void ItemAdding(SPItemEventProperties properties)
                base.ItemAdding(properties);
               string StartTime = properties.AfterProperties["Start Time"].ToString();
               string EndTime = properties.AfterProperties["End Time"].ToString();
    Error
    Object reference not set to an instance of an object.
    Use the New "Keyword to create an object instance
    Can any one help me how can I do it.
    Thanks,
    Quality Communication Provides
    Quality Work.
    http://siddiq-sharepoint2010.blogspot.in/
    Siddiqali Mohammad .

    Hi,
          Have you tried with the code snippet as mentioned below
    string EndDate = Convert.ToString(properties.AfterProperties["EndDate"]);
    string StartDate = Convert.ToString(properties.AfterProperties["EventDate"]);
    If my post is helpful - please click on the green arrow to mark it as answer

Maybe you are looking for

  • Result set Problem...URGENT

    I have doubt about my getObject method, my database attribute got varchar and number, can i use getObject method to retrieve??? Because i encounter null error when i use getObject for my database..... I f any sample to elobrate will be better.

  • DPM 2012 R2: over W2008 o W2012 server?

    Hi, I have a simply question: With DPM 2012 R2, is recommended to migrate to windows 2012? Out actual plataform is W2008 R2 updated but we dont know if a W2012 plataform can bring improvements with performance or similars... Regards & thanks.

  • Why shoutcast stopped

    can someone help me with my shoutcast app . it stopped working

  • Problema iPhone 5, APN Wind si cancella

    A me capita alcune volte che magari esco di casa e il telefono non si connette al 3G (pur essendoci scritto sopra), vado a controllare in Generali > Cellulare > Network e in APN > Indirizzo non trovo nulla. Inserisco appunto "Internet.wind" e riparte

  • ACS and Cisco Works

    I have landed a pretty big WLAN roll out. 75 1231 WAP's and ACS for authencation and Cisco Works with WLAN engine installed. ACS Radius should be the straight forward to configure has anyone run into any gotchas installing it. Cisco Works also should