Less than 42 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there anything smaller that the byte?  RSS feed

 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm working with java NIO, which uses ByteBuffers to transport data across the wire. I was wondering if it would be possible to compress the bytes in the ByteBuffer, for instance by using the *GZIP* classes delivered with the JDK or if the outcome of a GZIP compression would be a byte (in this case I would have already what I am looking for).
Thanks.
Marco
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"byte" is the smallest data type in Java. You can address individual bits using the bitwise operators &, |, and ~, but that's not quite the same thing.
Anyway, to answer your question: you can indeed compress bytes. The result would be a fewer number of bytes. GZIPOutputStream would indeed be one way to do this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!