Bits and Bytes

Hello,
As much as I know Java can only stream bytes and cannot save a single bit to a file. However is there any place where this is actually documented? and am I right to state this?
Thanks and Regards,
Sim085

Manfolium2 wrote:
Single bits or even bytes are impractical because of addressing. ( since you have to store the addresses somewhere on the drive, too ) If you save a one bit file you still use the the whole address bin. It's like you rent a huge P.O. box and fill it with one letter. You still have the whole box reserved for you. Most drive formatters will allocate 4Mb to one address. This is common in all computing devices and all laguages. But, if you are referring to the java bytecode,yes when you compile a .java file it becomes encoded in an intermediate code (bytecode) like C#. This way it can run on any machine that has the Java Runtime Environment since it will be compiled into machine code (binary) when it is run by the Java Virtual Machine. This is the foundation of Java and distributed programming. So, yes it is very documented. I'm not sure if this helps. If you want to know more about bytecode and its advantages/disadvantages go to: [http://java.sun.com/docs/white/langenv/Security.doc3.html]
I like that post-box analogy. Thanx for the fish.
Most drive formatters will allocate 4Mb to one address.Ummm... 4meg sounds big ???? I thought the block size was 1k on most modern IDE drives.

Similar Messages

  • Help !! Bits and Bytes - Come get these Dukes

    Can someone please shed some light on this ... I come from a C background and had no problems reading files in bits. I can't seem to find a way to read bit by bit in Java.
    I have a file which is written in an unknown format. All I have been told is that it could be either 4 / 5 / 6 etc bits per byte.
    I want to write a program that can create the above byte sizes and then print the ascii equivilent.
    So any help or an example on how to read a file bit by bit would be most appreciated.
    Robin

    I come from a C background and had no problems reading files in bitsInteresting!
    I can't seem to find a way to read bit by bit in Java.That's because there isn't any bit reader in Java but there is nothing to stop you from reading a byte at a time and pick the bits you want..... It seems to me you're not going to get very far without having more info on what's in the file. BigEndian/LittleEndian could compound your problem.
    Have fun!
    ;o)
    V.V.

  • Bits and Byte Manipulation

    Hi,
    Can anyone help?
    I have and array of 4 bytes - hostIP[].
    01000010
    11110001
    11011000
    00011010
    [Just for info, they come from InetAddress.getByName(host).getAddress()].
    I tried to hook them all together into a 32-bit int with this code:
    byte[] hostIP;
    try{
       hostIP = InetAddress.getByName(host).getAddress();
    } catch(Exception e){
       return
    int serverCode = 0;
    for(int n = 0; n < 4; n++){
       serverCode <<=8;
       serverCode |=hostIP[n];
    }The first iteration to add hostIP[0] works fine and leaves serverCode =
    00000000000000000000000001000010
    the <<8 works fine and gives
    00000000000000000100001000000000
    but then -- serverCode |= hostIP[1] -- leaves
    11111111111111111111111111110001
    i.e. I lost hostIP[0] when I added hostIP[1].
    It seems that when the left bit of the 8-bit hostIP[n] is a 1-bit, JAVA casts hostIP[n] to a 32-bit int with 1-bits propogated to fill the left 24 bits before doing |=.
    Then I lose hostIP[0] that I previously shifted into the 9th to 16th bit of serverCode.
    Note: I got this code from an example in the O'Reilly Java Servlet Programing book where it was suggested that the 4 bytes could be hooked together to make a 32-bit key, but it sure doesn't seem to work.
    Any help.

    It seems that when the left bit of the 8-bit
    hostIP[n] is a 1-bit, JAVA casts hostIP[n] to a
    32-bit int with 1-bits propogated to fill the left 24
    bits before doing |=.This is because it needs to cast the byte value to an integer. When it does this if the first bit is 1 it is a negative number, and the keep the same 2's complement value it has to fill the other bits with a one.
    I would just use something like "serverCode |=(hostIP[n] & 0x00FF)" to mask off the unnecessary bits.

  • How large can a LabVIEW Queue in elements and bytes?

    How large can a LabVIEW Queue in elements and bytes?

    rocke72 wrote:
    How large can a LabVIEW Queue in elements and bytes?
    In
    elements it is likely something like 2^31. In bytes it is most probably
    around the same number or better, depending how exactly the different
    queue elements are stored. I think they are stored as independent
    pointers so it would be theoretically better than those 2^31. In
    practice however starting to allocated so much memory in LabVIEW will
    always cause problems on nowadays computers. Without 64 bit CPU and OS
    going above 2 GB of memory per application is very hard and as far as I
    know not supported by LabVIEW.
    Also allocating many chunks of memory (like a few million queue
    elements holding strings) will definitely slow down your system tremendously eventhough
    it will work but the OS memory manager will be really stress tested
    then.
    Rolf Kalbermatter
    Message Edited by rolfk on 06-09-2006 12:24 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How do I swap 64-bit and 32-bit floats from little-endian to big-ending

    I am trying to read a file that could contain a list of 64-bit floats or 32-bit floats that were written on a PC so they are little-endian.
    I need to convert the float values to big-endian so that I can process the values. I know that straight swapping each byte with the adjacent byte doesn't work (especially since their floating point values). I've tried swapping them end for end (i.e., byte 15 from the file becomes byte 0 in my array) and that didn't work either.
    I know that if I were to read the little-endian float into the big-endian float type (float or double) that the format is pretty much lost (from little I understand about how floating point values are stored in memory).
    So, what I need is a way to read in a series of little-endian floating point values (64-bit and 32-bit) into a big-endian array of floating point values.
    Anyone have any ideas on how to do this? Any help would be much appreciated.

    A 64-bit double is represented by the sign bit, an 11-bit (biased) exponent
    followed by a 52-bit mantissa. Both x86 and SPARC use the exact same
    representation for 64-bit double. The only difference is the endianness
    when stored to memory, as you observed.
    A 32-bit float is represented by the sign bit, an 8-bit (biased) exponent
    followed by a 23-bit mantissa. Again, both x86 and SPARC use the exact
    same representation for 32-bit float modulo endianness.
    As you can see, a 64-bit double is not merely a pair of 32-bit float.
    You need to know exactly how the floating-point data was written:
    if a 32-bit float was written, you must endian-swap it as a 32-bit float;
    if a 64-bit double was written, you must endian-swap it as a 64-bit double.

  • Separating 16 bits of data into one 12 bit and one 4 bit channel

    I have 16 bits of binary data and i'm trying to split these into one 12 bit and one 4 bit channel. I know that I could use something like:
    Dim Channel1 : Set Channel1 = Block.Channels.Add("Channel1", eI16)
    Channel1.Formatter.Bitmask = 4,095 'xxxx 1111 1111 1111
    but, i'm not sure how to grab those 4 bits out of the 16 bit channel1 and make channel2. It's like i almost need to say something like:
    Dim Channel2 : Set Channel2 = Block.Channels.Add("Channel2", eI16)
    Channel2 = Channel1.Formatter.Bitmask = 61,440 '1111 xxxx xxxx xxxx
    Can anyone help out???? thanks.

    OK...This is still straightforward. Her is what you want to do :
    CurrPos = File.Position ' remember where the block starts
    Set Block = File.GetBinaryBlock()
    ' set up all channels which can be read directly
    Dim Channel1 : Set Channel1 = Block.Channels.Add("Channel1", eU16)
    Dim Channel2 : Set Channel2 = Block.Channels.Add("Channel2", eByte)
    Dim ChannelPH : Set ChannelPH = Block.Channels.Add("Dummy", eU16) ' just a placeholder
    Dim Channel5 : Set Channel5 = Block.Channels.Add("Channel5", eU16)
    Dim Channel6 : Set Channel6 = Block.Channels.Add("Channel6", eByte)
    ' Now we need a block which has one channel only. This channel will be used to extract the bits.
    ' The block needs to start where the third schannel of the above block starts :
    File.Position = CurrPos + 2+1 ' 2 for the U16 channel, 1 for the byte channel
    Set Block = File.GetBinaryBlock()
    ' Set the scan width. This defines the gaps between the values of a channel
    Block.BlockWidth = 2+1+2+2+1 ' U16 + Byte + U16 + U16 + Byte
    Dim Channel3 : Set Channel3 = Block.Channels.Add("Channel3", eU16)
    ' .. apply bitmask and scaling (see my last example)
    ' Do the same for the second channel
    Set Block = File.GetBinaryBlock()
    ' Set the scan width. This defines the gaps between the values of a channel
    Block.BlockWidth = 2+1+2+2+1 ' U16 + Byte + U16 + U16 + Byte
    Dim Channel4 : Set Channel4 = Block.Channels.Add("Channel4", eU16)
    .. apply bitmask and scaling (see my last example)
    Do the same for the second channel
    I hope this works as expected. Let me know if you need more help...
    Andreas

  • Best way to combine 8-bit and 16-bit image files?

    I produce large photographic art prints by combining my own edited 16-bit RAW photo images with 8-bit stock photo images and 8-bit photoshop artwork. I used to just reduce my 16-bit photos to 8-bit and then edit my composite image as 8-bit, but I ran into banding and other problems in the color gradients I created later in my composite image.
    I want my composite image to be 16-bit to get more accurate colors and better gradients. What is the best way to bring 8-bit image files into my composition and maintain best quality? Is it good to convert 8-bit images to 16-bit in PS before importing? I also heard about bringing 8-bit images in as Smart Objects? Thanks for any help on this.

    *Photonic wrote:
    Thanks Jack and Noel. My workflow usually starts w. a 16-bit RAW image brought into Photoshop as the background layer of the master file. Color space is AdobeRGB. Then 8-bit stock photo and art elements (objects) are brought in by dragging the open 8-bit image up to the master image file tab, and then dropping it back into the image window after the file opens.
    Should I use the "Paste In" command instead? I usually avoid copy/paste since some of my element files are usually over 100MB and that seems to challenge my Mac after a while.
    Could I convert the 8-bit image files prior to import, like Noel suggests (Image>Mode>16bits)?  Thanks.
    There is no need to convert 8bit open documents to 16bit mode Photoshop will convert the copied layers to 16bit bit during the drag copy.  Converting the open document would just increase Photoshop RAM usage every layer pixels bytes used  would double in size.
    If you element files are over 100MB they are most likely layered files.  If all you need is a composite you should avoid using Place for that will needlessly inflate your document size. Instead open the element file create a new layer that is a stamp visible layer (Shift+Alt|Opt+Ctrl|Cmd+E) and drag that layer to you document then close nosave your element file. Copy only copies the targeted layer or there is a Copy Merge that copies the composit merge of all targeted layers. It a bit hard to create an action that would be able to use Copy or Copy Merge. Using the above stamp visible way can be made into an action. You also do not want to drag all the layers to your document if you just need a composit layer.
    You could also automate the element file copy with an action.
    Action Step 1 Insert menu into File>Open this will be an interactive step you must select a file to open. When the action is played.
    Step 2 (Shift+Alt|Opt+Ctrl|Cmd+N) Create a new empty layer This will always work
    Step 3 (Shift+Alt|Opt+Ctrl|Cmd+E) stamp visible layers into the new layer
    Step 4 (Ctrl|Cmd+A) select all
    Step 5 (Ctrl|Cmd+C) Copy
    Step 6 Close current document no save
    Step 7 (Ctrl|Cmd+P) Paste into the document your working on Photoshop will convert to 16bit if the document is 16bit mode and the clipboard content is 8bit.
    When you use Photoshop and do something.  Think to yourself how did Photoshop do what you asked it to do. Thing about what is involved what layers must be used etc. How is the feature/function done.
    Message was edited by: JJMack
    Message was edited by: JJMack

  • Binary, Bits and Hexidecimal

    I am developing code to decode handphone PDU.
    I need to decode the hexidecimal in the PDU into binary bits first.
    Then I need to take every 7 bits and form them into a character.
    E.g. A201 will give 1010 0010 0000 0001
    so the code will have to return 0100010 as ASCII for the first character, 1100000 as ASCII for the second character.
    How can I go about doing that in the most efficient method.
    I was thinking about converting to string first (0's and 1's), then manually extract out every 7 bits and do the processing. But that looks quite tedious.
    Can anybody comment on this. Thanks!

    Can't see where the 1100000 comes from.
    Have you really got characters on 7 bit boundaries? That would be very unusual and inconvenient.
    This kind of bit manipulation is best tackled with shift and mask operations of which this will be a particularly tiresome example. You need to load your hex data into an array of, I would suggest, ints, loading two hex digits at a time. Work in blocks of 7 bytes (7 bytes becomes 8 characters).
    int[] codes = new int[7];
    String hex = "a7882312228823"; // say
    for(int i = 0; i < 7; i++)
         codes[i] = Integer.parseInt(hex.substring(2 * i, 2 * i + 2);Then you need to extract the characters by combining the appropriate bits from each byte of data.
    char output = new  char[8[;
    output[0] = (codes[0] >> 1);   // first 7 bits of code 0
    output[1] = (codes[0] << 7) | (codes[1] >> 2); // bottom bit of first and 6 bits from second
    output[2] = (codes[1] << 6) | (codes[2] >> 3); // bottom 2 bits of second and top 5 from third
    ... etc ...Of course it's a lot messier than this because your data might not be a multiple of 7 bytes and the data supply is obviously more complicated.

  • Difference between int and byte

    what is the main difference between int and byte?

    A byte is the format data is stored in memory in past. 8 bits.
    An int is a format likewise you get it as value from the accumulator. For X64 that is Int64.
    For compatibility the "Integer" is kept currently on Int32, the register format from the X86 computers. 
    Older computers likewise the 8088 had an 8 bit Int and therefore that was the same as the byte.
    The 80286 had a 16 bits Integer.
    Success
    Cor

  • Creation of Add-on package for 64 bit and 32 bit SAP Business One Client

    Please help me creating package for 64 bit and 32 bit SAP Business One. If Add-on executable is compiled with x86 option then there is no issue of connecting Add-on with 32 bit SAP Business one and if Add-on executable is compiled with Any CPU option then there is no issue of connecting Add-on with 64 bit SAP Business one. Problems are mentioned as below
    1. My Add-on uses MS ACCESS connection and the connection is read using Jet OLEDB 4.0 provider. It works fine for x86 compile mode but not when compile mode is Any CPU. I searched for the issue on Google and found a solution to change MS ACCESS connection provider to ACE.OLEDB.12.0 but again ACE provider is installed according to the Office version i.e. 32 bit or 64 bit office suite. If I install 32 bit ACE provider then Add-on executable compiled with x86 version is working fine but with Any CPU option throws error as provider is not registered on current machine.
    2. Secodly, our license validation activex dll is build using vb 6.0 and therefore when Add-on executable is compiled using Any CPU option, Add-on EXE cannot read from license dll. Any suggestion, how the activeX dll can be compiled whose component can be created from for X86 compiled exe and any cpu compiled exe.
    Please help because we are stuck in this issue and cannot move forward.
    Thanks.

    Hi Alejandro,
    That is one solution but did your add on used ms access connection? if you used Jet oledb to connection string or ace oledb connection string? what if 32 bit office is installed and what if 64 office is installed? how did you found the office version in install script? after determining the office version how did you installed Microsoft redistributable for ace oledb (32 bit or 64 bi )?
    I am sorry that I asked many questions but these are the problems where I am stuck with the addon installer?
    Thanks

  • Install sqldeveloper on windows 7 64 Bit and Oracle 11.2

    Hi,
    how can I find the rigth jdk. I installed JDK on C:\Program Files\Java\jdk1.6.0_23.
    I installed Oracle 11.2 including sqldeveloper. But I cannot find the correct folder to start sqldeveloper.
    Where can I find this path?
    When I include a path with java.exe I get the error "Unable to find a Java Virtual Machine. To point to a locacion of a Java Virtual Machine, pleaser refer to the Oracle9i Jdeveloper Install guide (jdev\install.html)" Where can I find this?
    Thank you for your help
    Siegwin

    I am on Windows 7 64 bit. I see that installing Oracle 11.2 database installs SQL Developer also but that doesn't work. I get the .bat file not found crap. What I then did was do a seperate install of SQL Developer for 64 bit, but that does NOT install the jdk.
    I then did the java install from:
    http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html
    I selected: jdk-6u25-windows-x64.exe
    I then point to the java.exe where this install loaded it (c:\program files\Java\jdk1.6.0_25\bin when I start up sql developer and it still gives the same error. I delete the SetJavaHome value in the sqldeveloper.conf file and try again over and over but it still gives the same error.
    So, I have windows 7 - 64 bit operating system. I have Oracle 11.2 database installed. I have a seperate installation of SQL Developer 64 bit and I have the java jdk for 64 bit installed.
    Nothing is working. Can anyone please steer me in the correct direction? Should I delete the second install of SQL Developer 64 bit and to an install of SQL Developer 32 bit?
    Please help

  • CC, CC 64 Bit, and CC 2014? WTF?

    It's bad enough Adobe can't figure out how to make the same features in one program work the same in a different program. To top it off, instead of improving what are now "apps" and integrating we now have more new programs to do the same thing (e.g. not just one for website creation, not just one for photos, not just one for illustrations, not just one for animation, etc...) and to top it off again they get rid of important programs like Soundbooth, and stop upgrading ones we need like Encore. I am beginning to think the CC is for Creative Chaos not Creative Cloud....
    So, I uninstalled my CS5 master suite finally and moved presumably up to CC. But, now do I not only have more than one program to do the same thing more now I also have 3 of each! Wow! That's STUPID. Sorry, I hate using that word, but what in the hell?
    Why is it when I go to my programs I have a CC version, a CC 64 bit, and now new to the Creative Chaos we have CC 2014 versions!!!!          What? Really? Someone, please help me maintain my sanity. Before I realized it I was using Premiere CC then I inadvertantly started using CC 2014. Then I was like "something is missing, oh, wait, what? there's more than one version of premiere in CC???" Then I realized "oh, there's 3 of Illustrator, Photoshop, and inDesign?
    I of course have a 64 bit system, so should I only use the 64 bit versions and just delete the shortcuts to the others? and when there isn't a 64bit version but instead just a CC and a CC2014 version, which do I use? I mean, I assume the CC 2014. But, in 2014 will something change, will I be like "damn it, I should have been using the CC not the CC2014"?
    Adobe, please clean up all your software, boil it down to just the ones we need, we don't need more than one program to do THE SAME THING. and once you boil it down, don't give us three versions of it, ask "do you want the 64 bit version or the 32" and we'll be happy to download precisely what we need. Or better yet, figure out a way to make it work with one program. And, of course while you're at it combine the CC and CC XXXX version of each, WTF???

    32bit programs are installed for those people who use plugins that have not been updated to 64bit
    CC and CC2014 have different source code bases, so they are different programs
    http://blogs.adobe.com/jkost/2014/06/installing-the-2014-release-of-creative-cloud.html
    This messages says (at least some) CC 2014 programs use NEW plugins https://forums.adobe.com/thread/1499663
    -so do not uninstall the older CC programs if you use plugins in your programs until you are sure you have plugins that work in CC2014
    If you are sure you don't need the old CC programs
    -http://helpx.adobe.com/creative-cloud/help/install-apps.html to install or uninstall
    -read reply #3 about the ORDER of uninstalling & installing https://forums.adobe.com/thread/1242671

  • What is difference between 32 bit and 64 bit sql server memory management

    What is difference between 32 bit and 64 bit sql server memory management
    Thanks
    Shashikala

    This is the basic difference...check if helps:
    A 32-bit CPU running 32-bit software (also known as the x86 platform) is so named because it is based on an architecture that can manipulate values that are up to 32 bits in length. This means that a 32-bit memory pointer can store a value between 0 and
    4,294,967,295 to reference a memory address. This equates to a maximum addressable space of 4GB on 32-bit platforms
    On the other hand 64-bit limit of 18,446,744,073,709,551,616, this number is so large that in memory/storage terminology it equates to 16 exabytes. You don’t come across that term very often, so to help understand the scale, here is the value converted to
    more commonly used measurements: 16 exabytes = 16,777,216 petabytes (16 million PB)➤ 17,179,869,184 terabytes (17 billion TB)➤ 17,592,186,044,416 gigabytes (17 trillion GB)➤
    As you can see, it is significantly larger than the 4GB virtual address space usable in 32-bit systems; it’s so large in fact that any hardware capable of using it all is sadly restricted to the realm of science fiction. Because of this, processor manufacturers
    decided to only implement a 44-bit address bus, which provides a virtual address space on 64-bit systems of 16TB. This was regarded as being more than enough address space for the foreseeable future and logically it’s split into an 8TB range for user mode
    and 8TB for kernel mode. Each 64-bit process running on an x64 platform will be able to address up to 8TB of VAS.
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • Windows XP Pro (32-bit) and Vista Ultimate (64-bit) on the same Mac Pro HD?

    Has anyone been able to install both Windows XP Pro (32-bit) and Windows Vista Ultimate (64-bit) on the same dedicated Windows hard drive? I have four HD in my Mac Pro, and one of them is dedicated for Windows (and bootable via Boot Camp). I found the following technical articles about installing Windows XP & Vista on the same hard drive (using two separate partitions) using a VMWare machine as the test system:
    http://apcmag.com/howto_dual_boot_vista_and_xp_with_vista_installed_first__the_stepbystepguide.htm
    http://apcmag.com/howto_dualboot_vista_with_xp__stepbystep_guide_withscreenshots.htm
    Has anyone successfully installed Windows XP (32-bit) and Vista 64-bit) on the same NTFS partition?
    I already have Windows XP Pro (32-bit) SP3 installed on my single NTFS hard drive. I am looking for the best way to add the Vista 64-bit installation on the same hard drive.
    Any thoughts and advise are appreciated.

    Windows has its own list of boot OSs, and default, from msconfig. It will sit and wait for xx-seconds on startup in Windows if you want to boot from an alternate.
    As to whether Apple's OS Switcher (aka startup disk bootcamp control panel or tray icon) sees both, I had Windows Home Premium and Ultimate 64, and pretty sure OS X saw both. That was pre-Leopard and before there were 64-bit Apple drivers.
    I can't think of any scenerio of wanting to mix 32-bit and 64-bit on the same paritition, you realize you can't install the one over the other and must do a clean install.
    When I added a partition out of main partition (I wanted to put search index and page file on their own partition) those partitions aren't seen - are hidden - to Leopard.

  • Install demo of CS4 Web Premium-Photoshop Installs 64 bit and x86 versions but 64 bit does not work

    Just installed the CS4 Web Premium demo onto a brand new 64 bit i7 processor with Windows Seven Home Premium machine with 9gb memory. The install seems to be fine except it installed a 64 bit version as well as x86 version into different folders. The x86 version works fine but the 64 bit version does not.
    Every time I try to open a file using "Open With' I get the following message "The application was unable to start correctly (0xc000007b). Click OK to close the application."
    First of all why does it install both versions and why does it try to open everything in the 64bit version even after specifically telling it to open in the x86 version (even after setting the default file association to the x86 version.
    I would of course like to use the 64 bit veriosn but if it not going to work. I'll use the 32 bit version. I just wantto be able to right click my mouse and be able to "Open With". I can open Photoshop 32 bit and open the file that way but it is a pain to do that way.
    Any help would be appreciated

    Both are installed to allow you to use 32 bit plugins. As for the problem, you'll get far more attention in the Photoshop forum.
    Bob

Maybe you are looking for