How to Write a file from hex format to another format

hi I am trying to create a file (IBM AFP-printer format) from the hex file which i have created after reading that IBM afp file. Now i have to do some changes in that hex file data and store it back to the same format.
I have tryed storing it using:
Writer out = new OutputStreamWriter(outputStream,"Cp1252");
but it is taking hex format only.
I have checked encoding of afp file by this code
File inputFile = new File( "C:\\ACode\\new2.afp" ) ;
          FileInputStream inputStream = new FileInputStream(inputFile );
     InputStreamReader in = new InputStreamReader(inputStream);
System.out.println(in.getEncoding());
it is showing Cp1252 only.
But i am unable to store it back to same format
Thanks

I don't really know what the IBM APF stream format is, but I suspect that your approach is not right. If you really want to read and write raw hex bytes, then do not use readers and writers; instead use pure streams. The reason is that readers and writers are designed to deal with character-oriented data, and will automatically perform translations on input and output.
On the other hand, if you could find the correct encoding/decoding software for the IBM format in question, well then readers/writers would be fine, and you could do all of your "internal" work in unicode.

Similar Messages

  • How do I move files from one album to another?

    How can I move files from one album to another? And why does itunes split up imported folders?

    Press the Command key while dragging them.
    (58054)

  • How do I transfer files from one computer to another without using cables??

    How do I transfer files from one computer to another without using cables?

    Wifi network
    Email
    Thumb Drive
    Online storage such as, iCloud Google Docs, SkyDrive, etc.

  • How do you copy files from one user to another

    How do you copy files from one user to another user on the same machine?

    open your home folder in finder move file to public, log into other account, click the go tab on the finder menu, select computer, your hard drive (Macintosh HD Default)>Users, the origonal user> public and drag that file to your specified folder.
    hope it works
    Craig.

  • How to transfer iweb files from one mac to another?

    How to transfer iweb files from one mac to another?
    I have a macbookpro, and I am planing to transfer my iweb data to a new imac, is this possiable and will everything transfer over properly? Will I have problems doing this and how can i do this?

    thank you very much!
    another question,
    if i were to use mobil me to publish my site (at this time i use ftp) will i have the ability to have an outside programer log into my mobil me account and adjust things around in my html codes or add things to my site without iweb? at this time i use ftp and transfer my files from cyberduck to my hosting company. I am new and not very firmilure with the files in my hosting company, so i have help sometimes from a programer that fixes my html codes sometimes for example this page of my site i had someone help me with...
    http://www.sylvartfloraldesigns.com/SylvartFloral_Designs/ScheduleConsultation.html
    will i have the option to do this through mobil me and have someone help me from an outside source, log into my mobil me account and have them adjust things for me?

  • How do i transfer files from one mac to another?

    how do i transfer my files from one mac to another mac?

    I normally use an External Hard Drive or Flash Drive for moving files from both Mac's and PC's, but if you want to move from an old Mac to a new one see > How to use Migration Assistant to transfer files from another Mac

  • How do i transfer files from 1 profile to another

    How do i transfer files from 1 user profile to another

    Choose Go to Folder from the Finder's Go menu, provide /Users/Shared/ as the path, drag them to it, and if desired, from there into the second account's home folder.
    (111041)

  • How to Move  a file from one Directory to another directory.

    Hi All
    i am having a Java standlone Application reqiurements are
    1---->Connection pool To be Created.
    2---->Using Thread to read Multiple Files Simulatneously.
    3----->After Reading Those file I have to Move it to another folder.
    Plz help me.If possible give me sample code .
    I am in deep trouble for this project.

    Use java.io.File.renameTo(...) (look it up in the API documentation).
    Renaming a file doesn't work if you're trying to move files from one disk to another disk. In that case, you have to copy the file and delete the original.

  • How to move a file from a page to another one in a wiki?

    Is it possible to move a file from a page to another one in a wiki (wiki server 4)?

    Files uploaded via "+" button and "Upload File to "My wiki name"" can be moved just like normal wiki pages by clicking the "sprocket" button and selecting "Move to Wiki"
    Fils attached via the "paperclip" button when editing a page, must be downloaded first, deleted from the initial page and reattached to the new page.

  • How to copy .gif files from one dir to another using runtime.exec

    hello sir/madem,
    i want to copy some gif and jepg files from one directory to another dir using swing.
    when i tried with using runtime.exec(String[]) i am getting the following error.
    anybody please tell me what is the problem in my program
    java.io.IOException: CreateProcess: ren c:/windows/desktop/copy.java c:/windows/
    cc.java error=0
    code:
    public class copy
         public static void main(String[] args)
              try{
                   String s[]=new String[3];
                        s[0]="ren";
    s[1]="c:/windows/desktop/copy.java";
    s[2]="c:/windows/cc.java";
              Runtime rt=Runtime.getRuntime();
    Process p=rt.exec(s);
              int i=p.waitFor();
              System.out.println("i is "+i);
              }catch(Exception e){System.out.println(e);}
    please mail me to [email protected]
    thanks in advance
    samba reddy
    india

    why use the Runtime? There are methods for this in the IO package ...

  • How do I delete files from HFS+-formatted network drive

    Relevant system components:
    Very recent iterations of a MBA and MBP both running 10.7.4
    Cisco Linksys e4200v1 wireless router, FWver1.0.04
    Seagate 1.5 Tb FA GoFlex external drive
    Full-size, single partition reformated by DiskUtility to HFS+ (Mac extended volume, Journaled)
    Connected by USB to storage port on e4200
    Storage set to share at root with either Anon r&w access or admin level user acct.
    Demonstrated read and write access
    I have set up an external drive as above.  The drive is to be used to archive large amounts of uncommonly used data (not a backup) and then is backed up to crashplan+ off-site. 
    The drive came formatted as FAT32 (I believe.) As we still have one PC and all individual files are smaller than 4Gb, I set up the archive drive as formated out of the box. 
    Data was written to the drive without issue, backed upi off-site with no issue and accessed a couple times.
    The issue came when recently upgraded some itunes albums.  These albums had been previously removed from the library and from the computer and stored in the archive drive.  These albums were upgraded and redownloaded from apple generating a copy of the album data, but in a superior format (no-drm, greater sampling rate.) This made the archived files obsolete and generated a risk of mixing versions.  I decided to delete the obsolete files from archive.
    When I attempted to do this by selecting, right-clicking and chosing "move to trash"  I was prompted that this was not a "undo-able" action, suggesting that while I was selecting "move to trash," the action would not generate a copy in the trash.  Next I was prompted to enter my user and PW.  The only user and PW combo that would not cause the dialog to "shake it's head" at me, was my computer user-specific password.  The network or drive associated user and PW combos would not take.  When I entered my computer user and PW, it was accepted, but a dialog labeled "Trash" popped up with small font, reading "The operation can't be completed because you don't have permission to access some of the items."
    Trying to delete only a random selection of one or two files would not work. 
    I checked the drive permissions and was only able to see "You have custom access."  This is not modifiable.  I attempted to alter my access permissions from the router, but made no headway.  Again, I could read and write, as the router setup suggests, but not "modify," to use a windows term.
    Assuming, with little data, that the FAT32 was perhaps at issue I unmounted the network drive, connected it by USB and reformated as above.  After formating, I tried the same procedure with no change in outcome.
    I am nearly 100% sure that when the drive was connected by usb, I could delete to my heart's content, but not when it is connected via network.
    I will note that the drive is accessed by first connecting to the router, which the mac sees as a "PC."  This access can be controlled, but can be set to anon.
    When I connect I see two identically named folders.  One is a sharepoint folder and one is a volume.  They access the same data. Deleting thorugh either route has identical outcomes.
    As I am a complete newb to Macs, I am really not sure where I should even begin to look for access.  Should I bind my router access to my user acct?  Is this even doable? Can I reset permissions to this folder through the terminal?  Is this really a Cisco or Seagate issue? 
    Any knowledgable advice is appretiated.  I can do the speculating.

    Ugh.
    This is not an Apple issue.  This is a permission issue associated directly with the router.  No settings on the mac need to be touched to solve this issue.
    In this specific case, it was required that I enter into the router storage settings (192.168.0.1,) disable all anon access, save settings, log in as admin (or just r&w) PRIOR TO deleting the files, then delete the files.
    I was trying to enter login info AFTER trying to delete the files. Obviously, that didn't work.
    Anyway.  I hope this might help someone. 

  • How do I Copy files from one directory to another?

    I know how to move files using the renameTo() method of File class, but is there a simple way to copy files, without the need of reading the input stream form one file and writing to a new one?

    Hi all,
    I ripped this off the jakarta-ant project's file copier (with a small tweak)..
    package com.museumcompany.util;
    import java.io.IOException;
    import java.io.File;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.lang.reflect.Method;
    import java.text.DecimalFormat;
    import java.util.Random;
    import java.util.Stack;
    import java.util.StringTokenizer;
    * This class also encapsulates methods which allow Files to be
    * refered to using abstract path names which are translated to native
    * system file paths at runtime as well as copying files or setting
    * there last modification time.
    * @author [email protected]
    * @author Conor MacNeill
    * @author Stefan Bodewig
    * @version $Revision: 1.8 $
    public class FileUtils {
    private static Random rand = new Random(System.currentTimeMillis());
    private static Object lockReflection = new Object();
    * Factory method.
    public static FileUtils newFileUtils() {
    return new FileUtils();
    * Empty constructor.
    protected FileUtils() {}
    * Convienence method to copy a file from a source to a destination.
    * Overwrite is prevented, and the last modified is kept.
    * @throws IOException
    public void copyFile(String sourceFile, String destFile) throws IOException {
    copyFile(new File(sourceFile), new File(destFile), false, true);
    * Method to copy a file from a source to a
    * destination specifying if
    * source files may overwrite newer destination files and the
    * last modified time of <code>destFile</code> file should be made equal
    * to the last modified time of <code>sourceFile</code>.
    * @throws IOException
    public void copyFile(File sourceFile, File destFile,
    boolean overwrite, boolean preserveLastModified)
    throws IOException {
    if (overwrite || !destFile.exists() ||
    destFile.lastModified() < sourceFile.lastModified()) {
    if (destFile.exists() && destFile.isFile()) {
    destFile.delete();
    // ensure that parent dir of dest file exists!
    // not using getParentFile method to stay 1.1 compat
    File parent = new File(destFile.getParent());
    if (!parent.exists()) {
    parent.mkdirs();
    FileInputStream in = new FileInputStream(sourceFile);
    FileOutputStream out = new FileOutputStream(destFile);
    byte[] buffer = new byte[8 * 1024];
    int count = 0;
    do {
    out.write(buffer, 0, count);
    count = in.read(buffer, 0, buffer.length);
    } while (count != -1);
    in.close();
    out.close();
    if (preserveLastModified) {
    destFile.setLastModified(sourceFile.lastModified());
    public File createTempFile(String prefix, String suffix, File parentDir) {
    File result = null;
    DecimalFormat fmt = new DecimalFormat("#####");
    synchronized (rand) {
    do {
    result = new File(parentDir,
    prefix + fmt.format(rand.nextInt())
    + suffix);
    } while (result.exists());
    return result;

  • How can I transfer files from one user to another user?

    I have a Macbook Air with 10.9.5.
    I have two admin users.  I want to transfer all the files from User A to User B's profile so that I can get rid of User A and just use User B from now on.  So far I can access the files if I change sharing permissions but the files are not under the root User B's folder still.   Any ideas on how to do this?  I also have greyed out folders when I created User B in the root directory. 
    Root folder /UserA/  includes all the usual folder links like desktop, documents, etc,  including some created one for example "myoldphotos".   When i created UserB/ it has all the desktop, documents, etc folders (but with nothing in them since it's new) but also the myoldphotos folder, except it's greyed out and I can't do anything with it at all or open it or anything. it's just there?  

    Thank you, that worked to transfer files.  After I move it into my normal home folder, can I delete it from the Shared folder?
    Also if anyone has any ideas on the greyed out folders I would be thankful.  For example I moved the 'myoldphotos' folder from users/UserA to users/Shared then from there to users/UserB  and it worked.  HOWEVER, the greyed out mysterious folder is still there and i can't do anything about it.  It also affected my new copied folder, changing the name from myoldphotos to "myoldphotos 2"  like as if there IS a folder there with the same name already.   I can't click on the greyed out folder to open it or anything. 

  • How to copy a file from one folder to another folder in Linux

    Hello everyone,
    Oracle forms 11g 11.1.2.0.0
    OS: Oracle Linux
    We use webutil to upload files to the application server from the client machine, and stores them in a folder named JOB_DOCS on the application server (This folder is created as a databse directory too). File types are JPEG, GIF, PDF, TXT, BMP, DOC, XLS etc...
    At a later stage when the user tries to view the uploaded documents, this was not getting displayed on the screen
    on our windows server, when the user clicks on the print button we copy the file from the JOB_DOCS folder to the forms\java folder using the below command
    HOST('COPY ' ||d:\JOB_DOCS\test.pdf||' '||'c:\oracle\middleware\as\forms\java\test.pdf ,NO_SCREEN);
    once the file is under the forms\java folder then it is getting displayed on the screen to print or save, and later we remove the file from forms\java folder.
    But my problem here is, recently we have installed our application on Oracle Linux server, and we have JOB_DOCS folder there, and the users can upload files to this folder also. How can we copy the file test.pdf from JOB_DOCS to forms/java in linux?
    And what could be the reson for the document cannot be accessed from the folder where it is saved? We tried giving folder permissions, adding the folder to PATH variable etc.

    For copying and moving directories you can use the cp and mv commands just like you use them with files. Yeah, I know. If you've already tried to copy a directory with cp, you've probably noticed that cp just complains at you. Probably it says something like cp: omitting directory yadda yadda. You see, the cp command wants you to use the -r option if you want to copy a directory with its contents. The -r means "copy recursively":
    $ cp -r dir1 dir2
    The above creates a directory named dir2 whose contents will be identical to dir1. However, if dir2 already exists, nothing will be overwritten: the directory dir1 will be copied into the dir2 directory under the name dir2/dir1.
    When renaming directories, you use the mv command exactly the same way as with files:
    $ mv dir1 dir2
    When dealing with directories, mv works a bit like cp does. If dir2 doesn't exist, the above will rename dir1 to dir2, but if dir2 exists, the directory dir1 will be moved into the dir2 directory under the name dir2/dir1.
    ref http://www.tuxfiles.org/linuxhelp/dirman.html

  • How to easy transfer files from one user to another (OSX Mavericks)

    Dear community,
    A few years ago i added my former user account, and i just found out that the name can be changed, but it wont change in the finder directories.
    So i decided to make a new, fresh user account for my mac pro.
    My question is:
    How can i easy transfer all the files to the new user account??? (Desktop, pictures, movies, music etc)
    I cant seem to easy access the files from the other user account...... And if possible, i would like to do it all at once.
    Please help me...
    Thnx in advance!!!
    Best regards,
    Nicky

    See: http://pondini.org/OSX/Transfer.html

Maybe you are looking for

  • Ok code is not getting in bp transaction

    HI All, Using BUPT i have added some custom fields in transaction BP for the role SAP Credit Management Under the Tab Fiscal Year Information. In my custom screen I have used the FM FS02_BUPA_BP021_GET to get the values in Fiscal Year Tab. Now my req

  • Mapping Error in CAF

    Hi there, when creating CAF Application services with custom operations, the added input parameters are treated as optional. This becomes obvious when researching the generated WSDL (Expose as web service) ---> maxOccurs=1, minOccurs=0. Now, if tryin

  • SQL Statement using LIKE and Subquery?

    Hi, I have two tables, one table is called "Restricted_Words", the other table is called "Content" .   I have a field called "short_desc" in the Content table and a field called "word" in the Restricted Words table. I want to write a query that will

  • How should a custom cursor image be constructed?

    This relates to Java 1.7_u11 and JFX 2.2.4 on Windows 7 64 bit. When I set a Node's cursor to Cursor.CROSSHAIR, the crosshair is displayed with complementary colour to its screen background (e.g. black on white, blue on yellow, etc.) However when I c

  • Service Metering by JBI

    Currently I am building web services with AXIS2. Now I am facing to create a service which records all usage of web services to a database table. Like "userId; Service url...etc". I tried some ESB tools like Mu, ServiceMix and WSO2 but still dont kno