Tipper. Class byte, the bytes in the class.

Is there a method/technics to empty my class in bytes and then restore back?

I know, there is no persiststore exists. But I want to store on SD card and restore back.

Currently, I have my own procedure that will generate the text file that contains each value of the variable in the class. Perhaps there is a simple method?

A quick search on google gives you the following:

http://www.itgalary.com/forum_posts.asp?tid=928&PID=1622

This is the API for the necessary strreams:

http://www.BlackBerry.com/developers/docs/6.0.0api/Java/IO/ByteArrayInputStream.html

http://www.BlackBerry.com/developers/docs/6.0.0api/Java/IO/ByteArrayOutputStream.html

http://www.BlackBerry.com/developers/docs/6.0.0api/Java/IO/DataInputStream.html

http://www.BlackBerry.com/developers/docs/6.0.0api/Java/IO/DataOutputStream.html

Tags: BlackBerry Developers

Similar Questions

  • close the reference on "read text file" - Ref num vs prefer class conflicts

    Dear users,

    Vi Analyzer asks me to close the refernce created by VI "read text file". So, I would close a refnum created by primitive VI "read text file". I used a direct wire, wiring by top and bottom of the casting, but each of them attend class conflicts (see the screenshot below). It is even possible to correctly transform the refnum (byte stream type reference) to refer (reference VI generic) and remove the refnum?

    See you soon,.

    You must use the close file.

  • several images capture and read their path to send the byte array to the web service

    Hello

    Have a problem when the image capture, the requirement is to open the camera and capture multiple images, and once done it should send the array of bytes to the web service, wrote the class with reader and Video Control of the code and then using the saved file to store image API, but when the user capture multiple images it replaces previous if I keep the path to say dynamic by using the date and time then how I just know what images are recently captured and their path, one time I know that the path of recently captured using new fileconnection images can read the image byte array.

    Hi Nishant,

    find the attached code. In this demo, you will find:

    (1) the use of the listner log file system

    (2) how to move data from one folder to another.

    (3) how to read file system byteArray.

  • How to use the getter class set extends thread?

    package mypackage;
    
    import java.io.ByteArrayInputStream;
    import java.io.InputStream;
    
    import javax.microedition.io.HttpConnection;
    import javax.microedition.xml.rpc.Element;
    
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    
    import net.rim.device.api.io.messaging.UsernamePasswordCredentials;
    import net.rim.device.api.io.transport.ConnectionFactory;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.RichTextField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.xml.parsers.DocumentBuilder;
    import net.rim.device.api.xml.parsers.DocumentBuilderFactory;
    
    public class search extends Thread{
    private MainScreen scren;
    
    String nul = "";
    MyScreen a = new MyScreen();
    
        public void run() {// define variables later used for parsing
            System.out.println("MASUK SEARCH!!!");
            String url = "http://localhost/ms/password.xml";
            Document doc = null;
            HttpConnection conn = null;
            try{
    
                //providing the location of the XML file,
                //your address might be different
                conn=(HttpConnection) new ConnectionFactory().getConnection(url).getConnection();
                System.out.println(conn.toString());
                conn.setRequestProperty("User-Agent",
                "Profile/MIDP-1.0 Confirguration/CLDC-1.0");
                conn.setRequestMethod(HttpConnection.GET);
                //next few lines creates variables to open a
                //stream, parse it, collect XML data and
                //extract the data which is required.
                //In this case they are elements,
                //node and the values of an element
                if(conn.getResponseCode()== HttpConnection.HTTP_OK){
                DocumentBuilderFactory docBuilderFactory= DocumentBuilderFactory. newInstance();
                System.out.println("masuk Sini");
    
                InputStream inputStream = conn.openInputStream();
    
                byte[] data = new byte[256];
                int len = 0;
                int size =0;
                StringBuffer raw = new StringBuffer();
                while(-1 !=(len =inputStream.read(data))){
                    raw.append(new String(data,0,len));
                    size +=len;
                }
                String content = raw.toString();
                InputStream input = new ByteArrayInputStream(content.getBytes());
    
                DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder();
                docBuilder.isValidating();
                System.out.println("dan sini");
                docBuilderFactory.setIgnoringElementContentWhitespace(true);
    
    //            Element root= doc.getDocumentElement();
    //            System.out.println(root.toString());
    //
    //            Element operation = (Element) root.getOwnerDocument();
    //            System.out.println(operation.toString());
    //            String layer = operation.getAttribute("Category");
    //            System.out.println(layer);
    //            root.normalize();
                System.out.println("terakhir");
    
    //            System.out.println("Category:"+layer);
                doc = docBuilder.parse(input);
                doc.getDocumentElement().normalize();
                NodeList list=doc.getElementsByTagName("password");
           System.out.println("Atleast!");
    
               String _node=new String();
               String  _element = new String();
                //this "for" loop is used to parse through the
                //XML document and extract all elements and their
                //value, so they can be displayed on the device
    
                for (int i=0;i
    

    Sorry for my bad English

    This is my code

    I want to pass the string, which is _Node I get it to XML parsing, to another class.

    can I get the string? Thank you

    already fact-_-

    user OOP

  • Implementation of the Classes of consequence

    All,

    I have some doubts regarding implementing the interfaces net.rim.device.api.notification.Consequence and net.rim.device.api.synchronization.SyncConverter on OS 5.0 +.

    Only two methods that I understand where startNotification and stopNotification, really.

    The doubts are:

    -What is the convert (DataBuffer, int, int) method supposed to do? Today I returns an instance of a new class of "Configuration" I created that implements Persistable and SyncObject, if I understand it needed. This object returns a different UID each time it is called.

    -What is the method convert (SyncObject, buffer, version) supposed to do? Today, I return a fixed value.

    -How is the newConfiguration (long, long, byte, int, object) method supposed to be implemented? Today I just return an instance of the same 'Configuration' new category I created.

    Any help on this is appreciated, as very little is said in the docs.

    Thanks in advance.

    Here are the methods for serialization and deserialization, which means that you need to convert your Java objects to a stream of bytes and a stream of bytes into Java objects.

    The version number is specific to your application so that he knows the format of the data.  This allows the version 2 of your application to restore data from a backup of the version 1 of your application (assuming that the format of your bytestream changed between versions).

    Take a look at the NotificationsDemo provided with the BlackBerry SDK in Java for an example of creating a custom notification (and use the interface of consequence).

  • Decryption of the output of DESEncryptorEngine using the encryption of the j2se class

    Does anyone know how this can be done?  I'm the encryption with the following:

            byte[] keyBytes = new byte[] { -62, 11, -39, 115, 61, -123, 91, -105 };        byte[] data = new byte[] { 90, 61, 43, 52, 81, 42, 124, 82 };        byte[] encryptedData = new byte[data.length];
    
            DESKey key = new DESKey( keyBytes );        DESEncryptorEngine encryptor = new DESEncryptorEngine( key );        encryptor.encrypt( data, 0, encryptedData, 0 );
    
            //encryptedData now equals { -27, 79, 100, 23, -113, 20, -24, -80 }; 
    

    And decryption using the class encryption of the j2se as follows:

            byte[] keyBytes = new byte[] { -62, 11, -39, 115, 61, -123, 91, -105 };        byte[] encryptedData = new byte[] { -27, 79, 100, 23, -113, 20, -24, -80 };
    
            SecretKeySpec key = new SecretKeySpec( keyBytes, "DES" );        Cipher cipher = Cipher.getInstance( "DES/ECB/NoPadding" );        cipher.init( Cipher.DECRYPT_MODE, key );        byte[] data = cipher.doFinal( encryptedData );
    
            //data now equals {24, 124, -74, -35, -115, -39, -65, -87}, which is WRONG!
    

    I tried all combinations possible of algorithm/mode/padding for Cipher.getInstance ().  What I am doing wrong?

    Thank you

    Mark

    Too bad, I was misinterpretting as the keys in the way which were used.

    Sorry,

    Mark

  • With the help of several classes and create an object of a class and calling its method in a different class.

    Creating a new class, I need to move my main method class SaveDate DynamicTest class. Below I've listed the code of both classes. The goal is to be able to run my class DynamicTest program. I need help to understand the process of moving my main method of a different class and creating an object of a class and calling its method.

    public class {SaveData

    private public static final map < String, Object > myCachedTreeMap = new TreeMap < String, Object > ();

    public static final List < String > getLines (final String resourceParam, final Charset charset) throws IOException {}

    System.out.println ("please:" + resourceParam);

    If {(myCachedTreeMap.containsKey (resourceParam))

    Use the file cached, to avoid a further reading.

    System.out.println ("found in memory:" + resourceParam);

    }

    else {}

    Load the file from the disk

    System.out.println ("found in memory:" + resourceParam);

    }

    Returns a null value.

    }

    Public Shared Sub main (String [] args) throws IOException {}

    String target_dir = "C:\\myfiles\\config\\en";

    Line = "C:\\myfiles\\config\\en\\output.txt";

    File dir = new File (target_dir);

    File files [] = dir.listFiles ();

    If (file == null: files.length < 1) {}

    System.out.println ("file list is empty...");

    return;

    }

    Open the Printwriter

    PrintWriter OutputStream = new PrintWriter (output);

    try {}

    for (textFile file: files) {}

    If (textFile.isFile () & & textFile.getName () .endsWith (".txt")) {}

    readFromDisk (textFile);

    }

    }

    }

    {Finally

    outputStream.close ();

    }

    String fileNameFromCache = "en_synonyms.txt";

    Sheet1 = myCachedTreeMap.get (fileNameFromCache) object;

    System.out.println (fileNameFromCache + ": \n" + "Sheet1");

    }

    @SuppressWarnings ("resource")

    private static Sub readFromDisk(File textFile) throws FileNotFoundException, IOException {}

    BufferedReader InputStream;

    inputStream = null;

    String content = "";

    try {}

    inputStream = new BufferedReader (new FileReader (textFile));

    content = readFile (textFile);

    System.out.println ("bytes read =" + content.length ());

    Save the content

    FileContentsObject Sheet1 = new FileContentsObject (System.currentTimeMillis (),

    textFile.lastModified (), content,

    textFile.getName (),

    getLines (null, null));

    Add to the map

    myCachedTreeMap.put (textFile.getName (), Sheet1);

    }

    {Finally

    If (inputStream! = null) {}

    inputStream.close ();

    }

    }

    }

    private static String readFile(File f) throws FileNotFoundException, IOException, UnsupportedEncodingException {}

    Text of StringBuilder = new StringBuilder (1024);

    read int, N = 1024 * 1024;

    char [] buffer = new char [N];

    BufferedReader br = null;

    try {}

    BR = new BufferedReader)

    (new) InputStreamReader

    (new FileInputStream (f), 'UTF8'));

    While (true) {}

    read = br.read (buffer, 0, N);

    If (read > 0)

    Text.Append (new String (buffer, 0, read));

    if(Read < N) {}

    break;

    }

    }

    }

    {Finally

    If (br! = null)

    Br. Close();

    }

    Return text.toString ();

    }

    private static final class FileContentsObject {}

    private long cachedTime; currentTime

    private long lastModifiedTimestamp;

    private string content

    List < String > lines;

    private String fileName;

    public FileContentsObject (long cachedTime, long lastModifiedTimestamp,

    Content string, String fileName, List < String > lines) {}

    this.cachedTime = cachedTime;

    this.lastModifiedTimestamp = lastModifiedTimestamp;

    This.contents = content;

    this.fileName = filename;

    This.Lines = lines;

    SimpleDateFormat sdf = new SimpleDateFormat ("MM/dd/yy hh: mm :"); ")

    System.out.println ("time & Date:" + sdf.format (cachedTime));

    System.out.println ("' last modification timestamp:" ")

    + sdf.format (lastModifiedTimestamp));

    }

    /**

    *

    * @return the lines of the file

    */

    List < String > getLines() {}

    Return this.lines;

    }

    public String toString() {}

    "return"Sheet1 {}"+" fileName =' ' + filename + '------"+", content = "" "

    + content + "\"+ ", lastModifiedTimestamp ="

    + lastModifiedTimestamp + ', CurrentTime & Date ='

    {+ cachedTime + '}';

    }

    }

    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    public class DynamicTest {}

    Public Shared Sub main (String [] args) {}

    Game characters charset = Charset.forName("UTF-8");

    try {}

    List < String > = CacheData.getLines lines ("en_synonyms", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    try {}

    List < String > = CacheData.getLines lines ("en_stopwords", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    }

    }

    I have read and watched videos about the creation of an object of a class and calling its method in a different class. I'm still confused on how to do it properly. By using the code below if someone can explain how to properly call the method of objects from my hand.

    Huh? You have NOT posted any 'hand' or any 'method of objects '.

    If you need help with the code, you need to view the code.

    The Java tutorials has dozens of trails "Classes and objects": what they are, how to create and how to use them.

    https://docs.Oracle.com/javase/tutorial/Java/javaOO/classes.html

    1. create an instance of a class

    2. call to one or more of the public methods of this class

    If the class has public static methods, you don't need to create an instance first.

    I suggest that you work your way through these tutorials. They include the WORKING example code.

  • A safety class is not found in this JAVA virtual machine for the following reason: sun.security.x509.CertAndKeyGen

    I'm trying to start OUD 11.1.2.2.0 after a new installation on Windows 2008 Server (oud - setup.bat) and I see the following error. Any ideas?

    [18/Apr / 2014:13:34:04-0600] category = gravity CORE = INFORMATION msgID = 132 msg = The Directory Server starts the configuration of the boot process

    [18/Apr / 2014:13:34:05-0600] category = gravity CORE VIEW msgID = 458886 msg = directory = unified Oracle 11.1.2.2.0 (build 20131115153045Z, R1311150604) commissioning

    [18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381717 msg = installation directory: C:\Oracle\Middleware\Oracle_OUD

    [18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381719 msg = Instance directory: C:\Oracle\Middleware\asinst_1\OUD

    [18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381713 msg = Information FMV: 1.8.0_05 - b13 by Oracle Corporation, architecture 32 bits, the size of the heap 652476416 bytes

    [18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381714 msg = JVM Host: slc00dbh.us.oracle.com, running Windows Server 2008 6.0 x 86, size of 8177541120 bytes of physical memory, the number of available processors 2

    [18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381715 msg = JVM Arguments: ' - Dorg.opends.server.scriptName = start - ds. "

    Exception in thread "main" java.lang.ExceptionInInitializerError: a safety class is not found in this JAVA virtual machine for the following reason: sun.security.x509.CertAndKeyGen

    to org.opends.server.util.Platform$ PlatformIMPL. < clinit > (Platform.java:132)

    to org.opends.server.util.Platform. < clinit > (Platform.java:85)

    at org.opends.server.util.CertificateManager.generateSelfSignedCertificate(CertificateManager.java:283)

    at org.opends.server.admin.AdministrationConnector.createSelfSignedCertifIfNeeded(AdministrationConnector.java:703)

    at org.opends.server.admin.AdministrationConnector.initializeAdministrationConnector(AdministrationConnector.java:182)

    at org.opends.server.core.ConnectionHandlerConfigManager.initializeAdministrationConnectorConfig(ConnectionHandlerConfigManager.java:356)

    at org.opends.server.core.DirectoryServer.initializeAdministrationConnector(DirectoryServer.java:2872)

    at org.opends.server.core.DirectoryServer.startServer(DirectoryServer.java:1539)

    at org.opends.server.core.DirectoryServer.main(DirectoryServer.java:9930)

    C:\Oracle\Middleware\Oracle_OUD > java-version

    Java version "1.8.0_05".

    Java (TM) SE Runtime Environment (build 1.8.0_05 - b13)

    The Client Java VM (build 25, 5 - b02, mixed mode, sharing)

    I used the following jdk based on the matrix and it worked fine:

    C:\Oracle\Middleware\Oracle_OUD>Java-version

    Java version "1.6.0_24".

    Java (TM) SE Runtime Environment (build 1.6.0_24 - b07)

    The Client Java VM (build 19.1 - b02, mixed mode, sharing)

  • Get the network traffic in bytes

    I try to get the number of bytes to pass by the network interface.

    The code I use is:

    String [] interfaceList = this.proxy.getNetInterfaceList ();
    a long time in = 0L;
    long out = 0L;

    for (String inteface: interfaceList) {}
    log. Debug (inteface);
    NetInterfaceStat netsstat = this.proxy.getNetInterfaceStat (inteface);
    in += netsstat.getRxBytes ();
    on += netsstat.getTxBytes ();
    }

    I'm not sure that I do it well, because the figures are not updated often. For example, I download a movie from youTube and the number does not change. I have to wait 30 seconds before it changes. Is the resolution of a minimum amount of time (on Windows 2000 Pro) is 30 seconds?

    Hi James,

    I saw this.proxy in your code, guess that is an instance of SigarProxyCache?  This class is a wrapper for caching the values returned by the underlying class of Sigar, 30 seconds by default.  You can change this value by default, but it seems you'd be better of just using the new Sigar() straight-up instead of the ProxyCache.

  • It should have read GET_FILE stream with personalized service in the java class

    Hi all

    Once I run service GET_FILE with in the java class of a custom service, how can read the stream with bytes (content).
    I cannot stream content of the DataBinder object or any other. I have not found any method of DataBinder to read the stream of content.

    Please help playback of streams of content of a java class personalized service?

    Thank you in advance.

    Hello

    In a service context, here's how retrieve the content as a stream:

    IdcFileDescriptor d = this.m_fileUtils.createDescriptorForRendition (this.m_binder, FileStoreProvider.R_WEB);
    InputStream in = this.m_fileStore.getInputStream (d, null);

    The binder must contain the information (metadata) to identify the document to be retrieved.

    Roman.

  • Problem using the pixel format indexed bytes in the PixelWriter setPixels method

    I'm trying to build a byte array and set it on a WritableImage using the PixelWriter setPixels method.

    If I use a RGB pixel format, it works. If I use a byte indexed pixel format, I get a NPE.
    Stride etc should be fine if I'm not mistaken.

    java.lang.NullPointerException
    to com.sun.javafx.image.impl.BaseByteToByteConverter. < init > (BaseByteToByteConverter.java:45)
    to com.sun.javafx.image.impl.General$ ByteToByteGeneralConverter. < init > (General.java:69)
    at com.sun.javafx.image.impl.General.create(General.java:44)
    at com.sun.javafx.image.PixelUtils.getB2BConverter(PixelUtils.java:223)
    to com.sun.prism.Image$ ByteAccess.setPixels (Image.java:770)
    at com.sun.prism.Image.setPixels(Image.java:606)
    to javafx.scene.image.WritableImage$ 2.setPixels(WritableImage.java:199)

    Independent, short example here:
    import java.nio.ByteBuffer;
    
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.image.ImageView;
    import javafx.scene.image.PixelFormat;
    import javafx.scene.image.WritableImage;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    
    public class IndexedColorTestApp extends Application {
    
        public static void main(String[] args) {
            launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            BorderPane borderPane = new BorderPane();
            Scene scene = new Scene(borderPane, 600, 1100);
            primaryStage.setScene(scene);
    
            ImageView imageView = new ImageView();
            borderPane.setCenter(imageView);
            primaryStage.show();
    
            int imageWidth = 200;
            int imageHeight = 200;
            WritableImage writableImage = new WritableImage(imageWidth, imageHeight);
    
            // this works
            byte[] rgbBytePixels = new byte[imageWidth * imageHeight * 3];
            PixelFormat<ByteBuffer> byteRgbFormat = PixelFormat.getByteRgbInstance();
            writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
                                                     byteRgbFormat, rgbBytePixels, 0, imageWidth * 3);
            imageView.setImage(writableImage);
    
            // this throws an NPE in setPixels()
            byte[] indexedBytePixels = new byte[imageWidth * imageHeight];
            int[] colorPalette = new int[256];
            PixelFormat<ByteBuffer> byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
            writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
                                                     byteIndexedFormat, indexedBytePixels, 0, imageWidth);
            imageView.setImage(writableImage);
        }
    
    }
    If there is no solution, maybe someone knows a solution? We chose to use the format indexed due to the size of the data / performance reasons.

    Published by: Andipa on 01.03.2013 10:52

    You have found a bug in the platform, filed against the project to-online http://javafx-jira.kenai.com to your sample code and a link to this forum question.
    Byte indexed pixel formats seem like a feature never completely (or maybe even any) implemented for me.

    The PixelFormat type uses your unsuccessful case is (PixelFormat.Type.BYTE_INDEXED):

    PixelFormat byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
    System.out.println(byteIndexedFormat.getType());
    

    Here are the valid PixelFormat types =>
    http://docs.Oracle.com/JavaFX/2/API/JavaFX/scene/image/PixelFormat.type.html

    BYTE_BGRA
    The pixels are stored in adjacent bytes with the non-premultiplied components stored in order of increasing index: blue, green, red, alpha.
    BYTE_BGRA_PRE
    The pixels are stored in adjacent bytes with the premultiplied components stored in order of increasing index: blue, green, red, alpha.
    BYTE_INDEXED
    The pixel colors are referenced by byte indices stored in the pixel array, with the byte interpreted as an unsigned index into a list of colors provided by the PixelFormat object.
    BYTE_RGB
    The opaque pixels are stored in adjacent bytes with the color components stored in order of increasing index: red, green, blue.
    INT_ARGB
    The pixels are stored in 32-bit integers with the non-premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.
    INT_ARGB_PRE
    The pixels are stored in 32-bit integers with the premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.
    

    As for a WritableImage native pixel format is not the same that you use the pixel format, the JavaFX platform needs to do a conversion while reading pixels in a format and write it in another format. To do this, he must be able to determine a PixelGetter for your PixelFormat (the PixelGetter is an internal thing, API not public).

    And here's the source determines the PixelGetter for a given type of PixelFormat:
    http://Hg.OpenJDK.Java.NET/openjfx/8/master/RT/file/06afa65a1aa3/JavaFX-UI-common/src/com/Sun/JavaFX/image/PixelUtils.Java

    119     public static  PixelGetter getGetter(PixelFormat pf) {
    120         switch (pf.getType()) {
    121             case BYTE_BGRA:
    122                 return (PixelGetter) ByteBgra.getter;
    123             case BYTE_BGRA_PRE:
    124                 return (PixelGetter) ByteBgraPre.getter;
    125             case INT_ARGB:
    126                 return (PixelGetter) IntArgb.getter;
    127             case INT_ARGB_PRE:
    128                 return (PixelGetter) IntArgbPre.getter;
    129             case BYTE_RGB:
    130                 return (PixelGetter) ByteRgb.getter;
    131         }
    132         return null;
    133     }
    

    As you can see, the BYTE_INDEXED format is not supported, and null is returned instead... it is the source of your NullPointerException.

  • How to access the BitmapData instance on the class that extends the charger?

    Hello. I use Flash CS6 to create an AIR application that loads an image from the computer, and then a pixel counts using its bitmap data.

    MyImg is a class that represents the loaded image.

    package com.utils {}

    import flash.display.Loader;

    SerializableAttribute public class extends {charger MyImg

    public void MyImg (): void {}

    }

    }

    }

    In my main class I manage the selection of files and loading.

    private var _myImage:MyImg = new MyImg();

    private var _file:FileReference;

    private var _fileTypes:FileFilter = new FileFilter ("Imagens: (*.jpeg, *.jpg, *.gif, *.png)", "*.jpeg;") *.jpg; *.gif; *.png");

    When the user clicks on a "load image" button on the stage, it calls loadMyImg().

    public void loadMyImg($e:MouseEvent):void {}

    chooseFile();

    }

    The user then selects the file he wants to do.

    private function chooseFile (): void {}

    Inasmuch = new FileReference();

    _File.addEventListener (Event.SELECT, fileSelected);

    _File.browse ([_fileTypes]);

    }

    Once you have selected the file, it is loaded as a byte array.

    private void fileSelected($e:Event):void {}

    _File.removeEventListener (Event.SELECT, fileSelected);

    _File.addEventListener (Event.COMPLETE, fileLoaded);

    _File.load ();

    }

    When it finishes loading it loads the byte array in _myImage.

    private void fileLoaded($e:Event):void {}

    _File.removeEventListener (Event.COMPLETE, fileLoaded);

    _myImage.contentLoaderInfo.addEventListener (Event.COMPLETE, dataReady);

    _myImage.loadBytes (_File.Data);

    }

    Once it's done I try to use the _myImage BitmapData, but cannot...

    private void dataReady($e:Event):void {}

    $e.target.loader.contentLoaderInfo.removeEventListener (Event.COMPLETE, dataReady);

    trace ($e.target + $e.target.content + $e.target.content.name + $e.target.content.bitmapData); Returns [object LoaderInfo] [object Bitmap] instance 155 [BitmapData object]

    trace (_myImage + _myImage.content + _myImage.content.name + _myImage.contentLoaderInfo + _myImage.contentLoaderInfo.content.name); instance of [object LoaderInfo] 155 155 instance [object Bitmap] returns [object MyImg]

    trace (_myImage.content.bitmapData) //compiler error: 1119 of bitmapData property possibly access not defined through a reference with static type flash.flashDisplay:DisplayObject.

    error //same trace (_myImage.contentLoaderInfo.content.bitmapData)

    }

    I don't understand what I'm doing wrong. Instances have the same name so that they are identical. They both trace as bitmaps, yet when I didn't access it from the event I do not get the bitmapData. Can someone tell me what I am doing wrong? I need to use the bitmapData of the classroom MyImg. I guess I could create a BitmapData variable in the class and give it the value of $e.target.content.bitmapData, but I still want to know why it can't be simpler.

    Thank you!

    Cast _myImage.content as bitmap:

    Bitmap (_myImage.Content)

  • initializeUpdate function of the com.ibm.jc CardManager class

    Hello
    I'm currently trying to create a JavaCard Applet loader and I get in trouble with the function initializeUpdate of the CardManager class. Below is the code that I write to initialize communication with the javacard/reader...
    the list of all players with a card shows
    readers is TerminalFactory.getDefault () .terminals () .list (State.CARD_PRESENT);.

    {if (Readers.IsEmpty ())}
    return;
    }

    establish a connection with the reader
    expression = (PCSCJCTerminal) JCTerminal.getInstance ("PCSC", readers.get (0) m:System.NET.SocketAddress.ToString () .substring (15));
    term. Open();
    RTA = new ATR (term.waitForCard (2000));

    connect to the map
    System.out.println ("layout map...");
    map = new JCard (term, atr, 2000);

    Select Cardmanager
    System.out.println ("selection of card manager...");
    cardmanager = new CardManager (card, CardManager.daid);
    cardmanager. Select();

    installation key
    Byte [] dfltKey = c2b ("404142434445464748494a4b4c4d4e4f");
    cardmanager.setKey (new OPKey (1, 1, OPKey.DES_ECB, dfltKey));
    cardmanager.setKey (new OPKey (1, 2, OPKey.DES_ECB, dfltKey));
    cardmanager.setKey (new OPKey (1, 3, OPKey.DES_ECB, dfltKey));

    authenticate to cardmanager
    System.out.println ("authenticate to the Manager of the map... \n");
    * cardmanager.initializeUpdate(1, 0,CardManager.SCP_01_05); *
    cardmanager.externalAuthenticate (OPApplet.APDU_CLR);

    When I run the program, everything goes well until the initializeUpdate function that throws the exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/jc/CL3
    at com.ibm.jc.OPApplet.initializeUpdate (unknown Source)
    at com.jnet.tools.LoadApplet.initConnection(LoadApplet.java:80)
    at com.jnet.tools.LoadApplet.load(LoadApplet.java:88)
    at com.jnet.benchmarks.ClientBenchs.runTest(ClientBenchs.java:636)
    at com.jnet.benchmarks.ClientBenchs.main(ClientBenchs.java:485)
    Caused by: java.lang.ClassNotFoundException: com.ibm.jc.CL3
    java.net.URLClassLoader to $1.run (unknown Source)
    at java.security.AccessController.doPrivileged (Native Method)
    at java.net.URLClassLoader.findClass (unknown Source)
    at java.lang.ClassLoader.loadClass (unknown Source)
    to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (unknown Source)
    at java.lang.ClassLoader.loadClass (unknown Source)
    at java.lang.ClassLoader.loadClassInternal (unknown Source)

    Since I'm quiet new in Java, I don't know what means this exception. I think that all the parameters of the function are good since I use the same when I "manually" load Applets on the map with the same settings and it works. My JRE is 1.6 (but I also tried 1.5), and the JCOP tools version is 3.2.7.
    I also tried with another card with various AIDS and SCP parameters different but I still have the same error.
    I thank in advance for the future fold

    862087 wrote:
    Since I'm quiet new in Java, I don't know what means this exception. I think that all the parameters of the function are good since I use the same when I "manually" load Applets on the map with the same settings and it works. My JRE is 1.6 (but I also tried 1.5), and the JCOP tools version is 3.2.7.

    The problem is not with your code, but your classpath. The card handler class seems that depends on another class that is missing when running. He is not recovered at the time of the compilation that you compile not against it. Try adding the crypto.jar located in the same location as the offcard.jar you are using.

    See you soon,.
    Shane

  • Get the null using PublicReportService_v11.wsdl bytes

    Hello

    I tried to use the latest PublicReportService_v11.wsdl because I want to use the function of dynamic data source. Unfortunately, when I use this wsdl instead of the original PublicReportService.wsdl, I get null on ReportResponse (getReportBytes()) bytes. However, the strange thing is that if I use PublicReportService.wsdl, everything works well. Hope you guys could help out me.

    Here are the details and a code snippet:

    BEEP version 10.1.3.4.1
    import com.oracle.xmlns.oxp.service.publicreportservice.ArrayOfString;
    import com.oracle.xmlns.oxp.service.publicreportservice.ReportResponse;
    import com.oracle.xmlns.oxp.service.v11.publicreportservice.ArrayOfParamNameValue;
    import com.oracle.xmlns.oxp.service.v11.publicreportservice.ParamNameValue;
    import com.oracle.xmlns.oxp.service.v11.publicreportservice.PublicReportService;
    import com.oracle.xmlns.oxp.service.v11.publicreportservice.PublicReportServiceService;
    import com.oracle.xmlns.oxp.service.v11.publicreportservice.ReportRequest;
    
    
    public ReportResponse fetchReport(String reportName,
        Map<String, String> args,
        String type) throws EJBException {
        AppServProperties props = AppServProperties.getInstance();
        String reportPath =
        props.getProperty(AppServProperties.BIPUB_REPORT_PATH);
        String reportFolder =
        props.getProperty(AppServProperties.BIPUB_REPORT_FOLDER);
        String reportService = reportPath + "/services/PublicReportService_v11";
        String userName = props.getProperty(AppServProperties.BIPUB_USER_NAME);
        String password = props.getProperty(AppServProperties.BIPUB_PASSWORD);
        String locale = props.getProperty(AppServProperties.BIPUB_LOCALE);
        try {
            final ArrayList<ParamNameValue> params =
            new ArrayList<ParamNameValue>();
            for (final Map.Entry<String, String> entry: args.entrySet()) {
                ParamNameValue pnv = new ParamNameValue();
                pnv.setMultiValuesAllowed(false);
                pnv.setName(entry.getKey());
                ArrayOfString values = new ArrayOfString() {
                    { // instance initializer
                        item = new ArrayList<String>();
                        item.add(entry.getValue());
                    }
                };
                
                pnv.setValues(values);
                params.add(pnv);
            }
            
            //Insert report folder in absolute path of the report
            if (reportFolder != null) {
                reportName = "/" + reportFolder + reportName;
            }
            
            ArrayOfParamNameValue paramNmVals = new ArrayOfParamNameValue() {
                { // instance initializer
                    item = params;
                }
            };
            
            WebServiceClient ann = PublicReportServiceService.class.getAnnotation(
                WebServiceClient.class);
            URL wsdl_url = getClass().getClassLoader().getResource(ann.wsdlLocation());
            
            PublicReportServiceService service = new PublicReportServiceService(
                wsdl_url, new QName(ann.targetNamespace(), ann.name()));
            
            PublicReportService proxy = service.getPort(PublicReportService.class);
            ((BindingProvider)proxy).getRequestContext()
                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                reportService);
            
            ReportRequest reportRequest = new ReportRequest();
            reportRequest.setAttributeFormat(type);
            reportRequest.setAttributeLocale(locale);
            reportRequest.setParameterNameValues(paramNmVals);
            reportRequest.setReportAbsolutePath(reportName);
            reportRequest.setSizeOfDataChunkDownload(-1);
            
            ReportResponse reportResponse = proxy.runReport(
            reportRequest, userName, password);
            return reportResponse;
        } catch (Exception e) {
            throw new EJBException(e);
        }
    }
    Am I missing something?

    Thank you!

    Published by: reg_22 on April 17, 2011 19:23

    Open v11.wsdl and search for the name space definitions
    I think that there is something wrong with that...
    Replace/oxp/service/PublicReportService by/oxp/service/v11/PublicReportService
    I guess that's the cause...
    I corrected reference.vb file and the client is currently working with the v11

  • Actual mechanism of object class as the superclass for all classes

    Hi all

    We know that all the classes of the java platform are the descendants of the object class. Even if we write a new class, in the absence of any explicit superclass, each class is implicitly a subclass of the object. As we expand it, not directly the object class, then how is the methods of the object are inherited from the class Sub that we wrote? How the java to maintain this hierarchy?

    Can you please explain this carefully?

    Thanks in advance,
    Uday

    Udaya Shankara Gandhi wrote:
    Hi all

    We know that all the classes of the java platform are the descendants of the object class. Even if we write a new class, in the absence of any explicit superclass, each class is implicitly a subclass of the object. As we expand it, not directly the object class, then how is the methods of the object are inherited from the class Sub that we wrote? How the java to maintain this hierarchy?

    Because the language is defined in this way. Compilers implement the language according to the rules of the DG JLS. Exactly how they do it is not defined. It is each compiler. As long as it respects the rules defined in the JLS to the code analysis and generate the .class file, that's all that matters. However, somewhere in the compiler's code which is about:

    if (class has an extends clause) {
      generate corresponding bytes for extends in .class file
    }
    else {
      generate bytes for extends java.lang.Object in .class file
    }
    

    No great mystery, or philosophical question.

Maybe you are looking for

  • Bookmarks don't open in tabs

    My cat went through my keyboard and somehow or another stop function that allows me to open a bookmark from the bookmark drop or bookmarks I have shortcuts to. Also, when I right click on a site marked with a bookmark to open it in a new tab, that no

  • Satellite P100-434 won't boot to the top

    Hi Ive got a Satellite P100-434 and Ive had for more than a year. Unfortunately today I couldn't get started. The power led lights up, the HARD drive makes light very briefly.The display lights. If she does not even there to boot in the bios. Any ide

  • Software build ID number

    Hi all Was wondering if I could get help find my version number of the software. HP Probook 6540 b, running under Windows 7 64-bit. Ctrl + alt + s and fn + esc shortcuts do nothing. I tried the key + R shortcut Windows as well and I got the version n

  • Reclassification of Windows7 32-bit to Windows 7 64 bit

    I am running Window 7 Ultimate 32-bit and upgrade to Windows7 Ultimate 64-bit.  Can I do without losing all my files and programs, i.e., a 'upgrade?  Or will I have to reinstall everything if I convert to a 64-bit version? Thank you

  • simple batch do really unusual things... [video]

    Here are a few pictures of them running... Megaupload also, I recently installed pstools and autohotkey. so I thought that there spoil... but I don't thing not e n related to the race of AHK and I put some pstools in its own folder in System 32 (and