Examples of SeekableByteArrayOutputStream


Examples of net.sourceforge.jiu.util.SeekableByteArrayOutputStream

      pos = raf.length();
    }
    else
    if (out instanceof SeekableByteArrayOutputStream)
    {
      SeekableByteArrayOutputStream sbaos = (SeekableByteArrayOutputStream)out;
      pos = sbaos.getPosition();
    }
    long compressedSize = pos - compressedDataOffset;
    compressedSize = Math.min(0xffff, compressedSize);
    /*
    System.out.println("compressed data offset=" + compressedDataOffset);
    System.out.println("position after compression=" + pos);
    System.out.println("compressed size=" + compressedSize + " / " + Integer.toHexString((int)compressedSize));
    */
    if (out instanceof RandomAccessFile)
    {
      RandomAccessFile raf = (RandomAccessFile)out;
      raf.seek(compressedDataOffset);
      raf.writeShort((int)compressedSize);
    }
    else
    if (out instanceof SeekableByteArrayOutputStream)
    {
      SeekableByteArrayOutputStream sbaos = (SeekableByteArrayOutputStream)out;
      sbaos.seek((int)compressedDataOffset);
      sbaos.write((int)(compressedSize >> 8) & 0xff);
      sbaos.write((int)compressedSize & 0xff);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.