How to copy bytes to an array byte variable....??

Hi everyone....can anyone help me out...i want to store byte into an array-byte variable,(byte by byte), which are returning from the readByte() function of DataInputStream.
Thank you

int filesize = request.getContentLength();
byte dataBytes[] = new byte[filesize];
int read=0;
while( read <filesize)
bytesRead[read++] =  in.readByte();  // *in* is object of DataInputStream
}Change all that to this:
int count;
byte[] buffer = newbyte[8192];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((count = in.read(buffer)) > 0)
  baos.write(buffer, 0, count);
byte[] data = baos.toByteArray();Of course, like your code, this assumes that the data will fit into memory. It is preferable to process the data read each time as you go rather than accumulating it all first and then processing. This saves both time and space.

Similar Messages

  • How do I store an Int, a short, and multiple bytes from file in byte array

    I'm attempting to do this for a project but can't figure out how to store the three values in one byte array. This is what i've tried
    public void send(byte[] input)
              // TODO
              ByteArrayInputStream bais = new ByteArrayInputStream(input);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              DataOutputStream dos = new DataOutputStream(baos);
              byte[] pData = new byte[100];
              try {
                   dos.writeShort(checkSum);
                   dos.writeInt(nextSeqNum);
                   pData=baos.toByteArray();
                   bais.read(pData);
              } catch (IOException e) {
              DatagramPacket dgp = new DatagramPacket(pData, pData.length);When i set pData=baos.toByteArray() it changes the size and then stops me from being able to read the other 94 bytes into the array to send. Any ideas?

    You don't need the ByteArrayInputStream at all.
    dos.writeShort(checkSum);
    dos.writeInt(nextSeqNum);
    dos.write(input);
    pData = baos.toByteArray();
    When i set pData=baos.toByteArray() it changes the sizeNo, it makes it refer to a new byte[] array containing what you've written to the BAOS. That's what it's supposed to do.

  • How to put a String into a byte array

    How can i put a String into a byte array byte[]. So that i can send it to the serial port for output to an LCD display. Cheers David

    javadocs for String
    getBytes
    public byte[] getBytes()
    Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
    Returns:
    The resultant byte arraySince:
    JDK1.1

  • How to convert a Image object to byte Array?

    Who can tell me, how to convert Image object to byte Array?
    Example:
    public byte[] convertImage(Image img) {
    byte[] b = new byte...........
    return b;

    Hello,
    any way would suit me, I just need a way to convert Image or BufferedImage to a byte[], so that I can save them. Actually I need to save both jpg and gif files without using any 3rd party classes. Please help me out.
    thanx and best wishes

  • How to remove blank data from a byte array

    Hi All,
    How to remove blank data from a byte array. Suppose I created a byte array as byte[] b = new byte[8192] and i read the data as inputstream.read(b). If the data that has been received is only 1000 bytes length, how to find out how much data has been read or how to delete that blank 7192 bytes of data?
    Thanking you,
    Regards,
    Shankar.

    1) Always try to sidestep this by allocating only the necessary amount of space required...
    2) If 1 is not possible, you will have to index byte for byte how much data was read into the array which
    denotes reading byte for byte... not ideal as this is relatively slow...
    Are you reading from a file?

  • How to save a value in a byte array, retrieve it and display it?

    Hi,
    I am doing a project for my data structures class that involves saving a value (given in String format) in a byte array (our 'memory'). Initially I just tried casting character by character into the byte array and casting back to char[] for retrieval (using .toString() to return what's supposed to be the original string), but this did not work. I tried the .getBytes() method, applying it to the string and then trying to recover it by placing the contents of the 'memory' in a byte array and applying toString(), but that didn't work either. I looked a bit and found this class, CharsetEncoder and CharsetDecoder. I tried to use these but when I try the compiler tells me I cannot instantiate CharsetDecoder because it is an abstract class. At this point I'm at a loss as to what I can do. Is there any way to place a string in a byte array and then recover the string in it's original format? For example, I might save a value in my particular class of "456". But when I try to recover the value from my 'memory' i.e. the byte array, it comes out like [gnue@hnju.... or something similar. I need it to output the original string ("456").
    Below is my code as it is right now, for the methods setValue and getValue.
    Thanks!
    public void setValue(String value) throws InvalidValueException {
         //… stores the given value in the memory area assigned to the variable
              if(this.type.isValidValue(value)){
                   bytes = value.getBytes();
                   int i,j,k;
                   int l=0;//might be wrong?
                   int ad=address-(address%4);
                   mem.readWord(ad);
                   reg=mem.getDataRegister();
                   if((address%4)+bytes.length-1<4){
                        for(i=address%4;i<address%4+bytes.length;i++)
                             reg.setByte(i, bytes[i]);
                        mem.setDataRegister(reg);
                        mem.writeWord(ad);
                   else if((address%4)+bytes.length-1>=4){
                        if(address%4!=0){
                             for(i=address%4;i<4;i++){
                                  reg.setByte(i, bytes);
                                  l++;
                             mem.setDataRegister(reg);
                             mem.writeWord(ad);
                             ad+=mem.WORDSIZE;
                        while(ad<address+bytes.length-(address+bytes.length)%4){
                             for(j=0;j<4;j++){
                                  reg.setByte(j, bytes[j+l]);
                                  l++;
                             mem.setDataRegister(reg);
                             mem.writeWord(ad);
                             ad+=mem.WORDSIZE;
                        if((address+bytes.length)%4!=0){
                             mem.readWord(ad);
                             reg=mem.getDataRegister();
                             for(k=0;k<(address+bytes.length)%4;k++){
                                  reg.setByte(k, bytes[k+l]);
                                  l++;
                             mem.setDataRegister(reg);
                             mem.writeWord(ad);
                   else
                        throw new InvalidValueException("The value passed is not valid.");
         /** Gets the current value of the variable.
         @return current value converted to String
         public String getValue() {
              //… returns the current value stored in the corresponding memory area
              //… value is converted to String
              bytes=new byte[this.getType().getSize()];
              int i,j,k;
              int l=0;//might be wrong?
              int ad=address-(address%4);
              mem.readWord(ad);
              reg=mem.getDataRegister();
              if((address%4)+bytes.length-1<4){
                   for(i=address%4;i<address%4+bytes.length;i++)
                        bytes[i] = reg.readByte(i);
              else if((address%4)+bytes.length-1>=4){
                   if(address%4!=0){
                        for(i=address%4;i<4;i++){
                             bytes[i] = reg.readByte(i);
                             l++;
                        ad+=mem.WORDSIZE;
                   mem.readWord(ad);
                   reg=mem.getDataRegister();
                   while(ad<address+bytes.length-(address+bytes.length)%4){
                        for(j=0;j<4;j++){
                             bytes[j+l] = reg.readByte(j);
                             l++;
                        ad+=mem.WORDSIZE;
                   if((address+bytes.length)%4!=0){
                        mem.readWord(ad);
                        reg=mem.getDataRegister();
                        for(k=0;k<(address+bytes.length)%4;k++){
                             bytes[k+l] = reg.readByte(k);
                             l++;
              return bytes.toString();

    You can certainly put it into a byte array and then construct a new String from that byte array. Just calling toString doesn't mean you'll automatically get a meaningful string out of it. Arrays do not override the toString method, so the use the one inherited from object.
    Look at String's constructors.

  • How to get the file size (in bytes) for all files in a directory?

    How to get the file size (in bytes) for all files in a directory?
    The following code does not work. isFile() does NOT recognize files as files but only as directories. Why?
    Furthermore the size is not retrieved correctly.
    How do I have to code it otherwise? Is there a way of not converting f-to-string-to-File again but iterate over all file objects instead?
    Thank you
    Peter
    java.io.File f = new java.io.File("D:/todo/");
    files = f.list();
    for (int i = 0; i < files.length; i++) {
    System.out.println("fn=" + files);
    if (new File(files[i]).isFile())
         System.out.println("file[" + i + "]=" + files[i] + " size=" + (new File(files[i])).length() ); }

    pstein wrote:
    ...The following code does not work. Work?! It does not even compile! Please consider posting code in the form of an SSCCE in future.
    Here is an SSCCE.
    import java.io.File;
    class ListFiles {
        public static void main(String[] args) {
            java.io.File f = new java.io.File("/media/disk");
            // provides only the file names, not the path/name!
            //String[] files = f.list();
            File[] files = f.listFiles();
            for (int i = 0; i < files.length; i++) {
                System.out.println("fn=" + files);
    if (files[i].isFile()) {
    System.out.println(
    "file[" +
    i +
    "]=" +
    files[i] +
    " size=" +
    (files[i]).length() );
    }Edit 1:
    Also, in future, when posting code, code snippets, HTML/XML or input/output, please use the code tags to retain the indentation and formatting.   To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.  It took me longer to clean up that code and turn it into an SSCCE, than it took to +solve the problem.+
    Edited by: AndrewThompson64 on Jul 21, 2009 8:47 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to copy data in text file into two-dimensional arrays?

    Greeting. Can somebody teach me how to copy the input file into two-dimensional arrays? I'm stuck in making a matrix with number ROWS and COLUMNS according to the data in "input.txt"
    import java.io.*;
    import java.util.*;
    public class array
        public static void main (String[] args) throws FileNotFoundException
        { Scanner sc = new Scanner (new FileReader("input.txt"));
            PrintWriter outfile = new PrintWriter("output.txt");
        int[][]matrix = new int[ROWS][COLUMNS];
    }my input.txt :
    a,b,c
    2,2,1
    1,1,1
    2,2,1
    3,3,1
    4,4,1
    5,5,1
    1,6,2
    2,7,2
    3,8,2
    4,9,2
    5,10,2

    import java.io.*;
    import java.util.*;
    public class array {
        public static void main(String[] args) throws IOException {
            FileInputStream in = null;
            FileOutputStream out = null;
    try {
        in = new FileInputStream("input.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = null;
        while ((line = reader.readLine()) != null) {
            String split[]=line.split(",");
    catch (IOException x) {
        System.err.println(x);
    } finally {
        if (in != null) in.close();
    }}}What after this?

  • Exception during receive an array bytes from servlet

    Hi! I have some problem with receive my array bytes. When I want to recive my array bytes at application site from servlet, I have an exception java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) near ObjectInputStream. I don't know what it's make. All looks good. Strings send I recive without any problems. Problem is with array bytes.
    URL url = new URL("http://127.0.0.1/App/servlet/Serwlet");
             URLConnection connect = url.openConnection();
            connect.setUseCaches(false);
             connect.setDefaultUseCaches(false);
             connect.setDoOutput(true);
         connect.setDoInput(true);    
    connect.setRequestProperty("Content-Type","application/x-java-serialized-object");
    ObjectOutputStream out = new sdfgObjectOutputStream(connect.getOutputStream());
              out.writeObject(arrayBytes);
              out.flush();
              out.close();
    //Here during debug is an exception
    ObjectInputStream in = new ObjectInputStream(connect.getInputStream());
              byte[] tmp = (byte[])in.readObject();
              in.close();
    System.out.println("Send array: "+arrayBytes);    
    System.out.println("Receive array: "+tmp);
    Servlet site :
    ObjectInputStream in = new ObjectInputStream(request.getInputStream());
                   byte[] tmp = (byte[])in.readObject();
                   in.close();
    response.setContentType("application/octet-stream");
                   ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
                   out.writeObject(tmp);
                   out.flush();
                   out.close();Any ideas? :]

    All this exception looks that :
    java.io.EOFException
         at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
         at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
         at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
         at java.io.ObjectInputStream.<init>(Unknown Source)
         at Klient.OdbiorcaButton.polaczenie(OdbiorcaButton.java:151)
         at Klient.OdbiorcaButton.actionPerformed(OdbiorcaButton.java:124)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

  • Replace in array byte content in java

    Hi
    All
    Is there any way to replace array byte content in java:
    byte[] b= new byte[fis.available()+1];
    I need to replace a text "Values" for "Value"
    Thanks

    Please search the forum. This question has been asked and answered many, many times.

  • How to read binary files wrt specific BYTE size and length??

    Hello Everyone,
                                I have a project I want to accomplish. I have a binary file, and I would like to read the data and print on wfm in a specific order and size.
    The data is 16 bit binary type , and needs to be read in chunks of 2 bytes.
    i have 30 bytes of sample 1.
    followed by 2 bytes of sample 2.
    followed by another 2 bytes of sample 3.
    steps 2-4 should be repeated 10 times and then i should read sample 4 which is of 2 bytes.....
    How should I do it?? I don't have any VI build... all i have is the example VI...
    can anyone pleasehelp me???
    Now on LabVIEW 10.0 on Win7

    smercurio_fc, sorry for the confusion, i will try my best to explain...
    1. No, i don;t have to read the file again, once it has read, I used
    while loop just to see the data updating (i press run, and before i can
    visualize i have the waveforms; i can get rid of the while loop)
    2. I have 30 different values of 1 sample. actually, the data is cmg
    from tri-axial accelerometer; each axis is of 10 bytes(hence 3*10 =
    30bytes)
    3. I am repeating the steps 2-4 10 times because the data was written
    into the binary file after 10 times sampling the sensors(if first 3
    samples are read @ 1000hz, sample 4 was read at 1000/10 = 100hz)
    4. I am using the graphs to interpret the values, that's it. The
    values are already scaled when they were wrote to the binary file, I
    have to simply interpret it.
    I have made some changes in the VI, now i am reading only the first
    30bytes, that too, in chunks of 10-10-10 bytes, and plotting the 3
    samples simultaneously on a waveform chart. (will approach 1
    sensor/sample at a time) and running the loop for 10 times. I have changed I8 to I16 now.
    Please let me know if it makes sense to you now.
    P.S. each sample is a sensor data.
    Now on LabVIEW 10.0 on Win7
    Attachments:
    data_read.vi ‏24 KB

  • How to copy file from global zone to non-global zone?

    Hi,
    I'm new in zone.
    I have installed a zone and I would like to install some programs.
    Could you please tell me how to copy downloaded file from internet to the new installed zone?
    Kind regards,
    Daniel

    I like to use zcp which came from BigAdmin I believe.
    #!/usr/bin/perl
    # zcp - copy a file from the global zone to a nonglobal zone. Solaris 10.
    # 10-Mar-2005, ver 0.50 (first release)
    # USAGE: zcp file1 zonename:file2
    # eg,
    # zcp /etc/syslog.conf workzone1:/tmp
    # Standard Disclaimer: This is freeware, use at your own risk.
    # 10-Mar-2005 Brendan Gregg Created this.
    $ENV{PATH} = "/usr/bin:/usr/sbin";
    $VERBOSE = 1;
    # Process arguments
    # check for arguments,
    if (@ARGV != 2) {
    die "USAGE: zcp file1 zonename:file2\n";
    # check source file exists,
    $srcpath = $ARGV[0];
    if (! -e $srcpath) {
    die "ERROR1: Can't find source file $srcpath\n";
    # check destination zone exists,
    ($destzone,$destpath) = split(/:/,$ARGV[1]);
    chomp(@Zones = `zoneadm list`);
    foreach $zone (@Zones) { $Zone{$zone} = 1; }
    unless ($Zone{$destzone}) {
    die "ERROR2: Can't find zone $destzone\n";
    # check if destination is a directory or filename,
    $dir = `zlogin -S $destzone '
    if [ -d "$destpath" ]; then echo 1; else echo 0; fi'`;
    if ($dir == 1) {
    $node = $srcpath;
    $node =~ s:.*/::;
    $destpath = "$destpath/$node";
    # Print message
    print "zcp from $srcpath, to zone $destzone, to file $destpath.\n" if $VERBOSE;
    # Copy File
    system("cat $srcpath | zlogin -S $destzone 'cat - > $destpath'");
    # Verify file copied
    $srcsize = -s $srcpath;
    $destinfo = `zlogin -S $destzone 'ls -l $destpath'`;
    @Fields = split(' ',$destinfo);
    $destsize = $Fields[4];
    if ($srcsize != $destsize) {
    print STDERR "ERROR3: Copy failed, size mismatch ".
    "($srcsize != $destsize)\n";
    } else {
    print "Copy successful ($destpath, $destsize bytes).\n" if $VERBOSE;
    }

  • How to create and use mutable array of UInt8

    Hello!
    If I get it right, UInt8 *buffer, buffer - is a pointer to a start of array?
    Then how to create and use mutable array of UInt8 pointers?
    The main target is a creation of the module that will store some byte array requests and will send all of them at the propriate moment.

    I try
    - (void) scheduleRequest:(UInt8 *)request {
    if (!scheduledRequests) scheduledRequests = [[NSMutableArray array] retain];
    [scheduledRequests addObject:request];
    But get warning:"passing argument 1 of 'addObject:' from incompatible pointer type"

  • How to copy large files - fast

    Hi, here is an I/O challenge: I need to copy large binary files under windows in one of my apps. File size can be above 2 GB. The copying should be as fast as possible. What would be the fastest way to do this?
    Here is what I've tried so far:
    1) Use FileInputStream/FileOutputStream with a byte buffer (see copy1 below)
    2) Use BufferedInputStream/BufferedOutputStream (see copy2 below)
    3) Use java.nio.FileChannel#transferTo (see copy3 below)
    4) Use a shell copy command (see copy4 below)
    Testing the four methods with a 500 MB file I get
    1) 525271525 Byte in 47141 ms (11142 kByte/s)
    2) 525271525 Byte in 68969 ms (7616 kByte/s)
    3) 525271525 Byte in 38765 ms (13550 kByte/s)
    4) 525271525 Byte in 37984 ms (13828 kByte/s)
    This is on a Pentium 4, 2.4 GHz, 512 MB RAM, Windows XP with JDK 1.4.2.
    Hence, my favorite method would be 3), since it is more portable than 4).
    However, with java.nio.FileChannel#transferTo I get exceptions for files larger than 2 GB. The exception is
    java.io.IOException: Falscher Parameter
      at sun.nio.ch.FileChannelImpl.map0(Native Method)
      at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:673)
      at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:421)
      at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:490)leading me to suspect that the long values used by Java to specify the file length are not supported by the native code, and that they may be downcast to a 32-bit signed number. (If anyone could shed some more light on this, I'd be grateful!) So, is there a better way than using 4), a shell copy command?
    Following is the code I used to for my test:import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.nio.channels.FileChannel;
    /** Class for testing different ways to copy files */
    public class TestCopy
      /** i/o buffer size */
      public static final int BUF_SIZE = 1024 * 1024;
      /** Copy method, using FileInputStream and byte buffer */
      void copy1(File source, File target) throws IOException
        FileInputStream in = new FileInputStream(source);
        FileOutputStream out = new FileOutputStream(target);
        byte[] buf = new byte[BUF_SIZE];
        int i;
        while ((i = in.read(buf, 0, BUF_SIZE)) != -1)
          out.write(buf, 0, i);
        in.close();
        out.close();
      /** Copy method, using BufferedInputStream */
      void copy2(File source, File target) throws IOException
        BufferedInputStream in =
          new BufferedInputStream(new FileInputStream(source), BUF_SIZE);
        BufferedOutputStream out =
          new BufferedOutputStream(new FileOutputStream(target), BUF_SIZE);
        int i;
        while ((i = in.read()) != -1)
          out.write(i);
        in.close();
        out.close();
      /** Copy method, using FileChannel#transferTo */
      void copy3(File source, File target) throws IOException
        FileChannel in = new FileInputStream(source).getChannel();
        FileChannel out = new FileOutputStream(target).getChannel();
        in.transferTo(0, in.size(), out);
        in.close();
        out.close();
      /** Copy method, using command shell copy */
      void copy4(File source, File target) throws IOException
        Process p =
          Runtime.getRuntime().exec(
            new String[] {
              "cmd",
              "/C",
              "copy",
              "/Y",
              "/B",
              source.getAbsolutePath(),
              target.getAbsolutePath()});
        int j;
        try
          j = p.waitFor();
          if (j != 0)
            throw new IOException("copy returned exit code " + j);
        catch (InterruptedException e1)
      public static void main(String[] args)
        if (args.length != 2)
          System.out.println("usage: java TestCopy <sourceFile> <targetFile>");
          return;
        File source = new File(args[0]);
        File target = new File(args[1]);
        if (!source.exists())
          System.out.println("File not found: " + args[0]);
          return;
        TestCopy tc = new TestCopy();
        try
          long time = System.currentTimeMillis();
          tc.copy1(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy1: "
              + source.length()
              + " Byte in "
              + time
              + " ms ("
              + source.length() / time
              + " kByte/s)");
          time = System.currentTimeMillis();
          tc.copy2(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy2: "
              + source.length()
              + " Byte in "
              + time
              + " ms("
              + source.length() / time
              + " kByte/s)");
          time = System.currentTimeMillis();
          tc.copy3(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy3: "
              + source.length()
              + " Byte in "
              + time
              + " ms("
              + source.length() / time
              + " kByte/s)");
          time = System.currentTimeMillis();
          tc.copy4(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy4: "
              + source.length()
              + " Byte in "
              + time
              + " ms("
              + source.length() / time
              + " kByte/s)");
        catch (IOException e)
          e.printStackTrace();
    }Cheers, HJK

    Hmm, I guess I have to agree with jschell. Runtime.exec("cmd /c copy <file1> <file2>"); is the way to go.
    The FileChannell#transferTo method in a loop, as asjf suggested, is not much slower, but it's a workaround. Using JNI to call the system command, is probably not worth the effort. I can't see how it will be faster than calling the shell copy command.
    Thank you all for your help! Cheers, HJK

  • Convert/Represent 1 byte char in 2 bytes

    Hello All,
    I would like to convert/represent the 1 byte char to 2 byte.
    for example the "Test ��" is a 9 byte string if i use getBytes()
    the byte array length is 7 bytes but if i use getBytes("UTF8")
    i'm getting 9 bytes but it's not printing "��"
    Now i want to represent them in a 2 byte. How do i do that?
    Regards
    G S Sundaram

    getBytes("UTF16-BE") or getBytes("UTF16-LE"). What is �� supposed to be here?

Maybe you are looking for

  • How to get values from the page excpet pagecontext.getparameter

    i have a requirement wherein i am passing paramteres from the "submit" button.but the problem being that,i have multiple rows in my page.what is happening is that my "submit" button is passing the values of the previous row,instead of the current row

  • When I want send file Numbers to my mail, ipad is block

    Hello when I try to send a file "NUMBERS" converting it to file "EXCEL or PDF"with my iPad get stuck and I can not send to my email. Thanks a lot.

  • Adobe Flash Player 10.2.152.32 Not working in I.E.8

    Hello I am getting a bit frustrated with Adobe Flash Player. The last three versions i have tried have all exhibited the same strange behaviour in that every clip i play on youtube or in other sites including CNN go frame by frame , maybe 1 frame a s

  • 3d object moves when merging

    So I haven't played with the 3d features in Photoshop very much and gave myself (what I thought) was a simple project to play with. I'm trying to make a little cog with a recessed color band. Have been doing an extrusion using vector objects. I extru

  • App for creating .ico files???

    I am looking for an app to create the .ico files that are used as the image for bookmarks. Anybody know any good OS X apps for this???