Class LhaOutputStream

java.lang.Object
java.io.OutputStream
jp.gr.java_conf.dangan.util.lha.LhaOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class LhaOutputStream extends OutputStream
???}???????X?g???[???? ???k?f?[?^???o???????????????[?e?B???e?B?N???X?B
java.util.zip.ZipOutputStream ???????C???^?[?t?F?C?X???????????????????B Zip??????ALHA???o?????{?? 2?p?X???????????A1?????G???g???????k?????????A ?G???g???S?????f?[?^???????????L?????????K?v???????B ???????????L?????????g?p??????????????? LhaRetainedOutputStream ?? LhaImmediateOutputStream ???g?p???????B
 -- revision history --
 $Log: LhaOutputStream.java,v $
 Revision 1.1.2.2  2005/05/03 07:48:40  dangan
 [bug fix]
     ???k?@?????q -lhd- ???w?????????A???k???T?C?Y???I???W?i???T?C?Y????????????????A
     ?K?? -lh0- ??????????????????B?????????f?B???N?g?????????i?[?????????????B

 Revision 1.1.2.1  2005/04/29 02:14:28  dangan
 [bug fix]
     ???k?@?????q -lhd- ???w?????????A???k???T?C?Y???I???W?i???T?C?Y????????????????A
     ?K?? -lh0- ??????????????????B?????????f?B???N?g?????????i?[?????????????B

 Revision 1.1  2002/12/08 00:00:00  dangan
 [maintenance]
     LhaConstants ???? CompressMethod ?????N???X???????X???????????C???B

 Revision 1.0  2002/08/05 00:00:00  dangan
 add to version control
 [change]
     ?R???X?g???N?^???? ?????? String encode ?????????????p?~?A
     Properties ???????????????????????B
 [maintenance]
     ?\?[?X????
     ?^?u?p?~
     ???C?Z???X????C??

 
Version:
$Revision: 1.1.2.2 $
Author:
$Author: dangan $
  • Constructor Summary

    Constructors
    Constructor
    Description
    out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
    ?????????@?\???????????g?p?????B?}???????A ???k???f?[?^???????????????L???????????t?@?C???????k????????B
    ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
    out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
    ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
    out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
    out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
    ?????????@?\???????????g?p?????B?}???????A ???k???f?[?^???????????????L???????????t?@?C???????k????????B
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    ?o???????S?????f?[?^???o?????A ?X?g???[??????????B
    void
    ?????o???????G???g????????A?????G???g?????o?????\?????????????B ???k?????s????(???k???T?C?Y?????k?O?T?C?Y??????????)?????A ???????????k???i?[?????B?G???g?????T?C?Y????????????A ?}???????????????????????????????B
    void
    flush ???????????????s???B ???????????????????????G???g?????f?[?^?? ?????????@?\???????}?????????w???????B ?}???? PostLzssDecoder?ALzssOutputStream ???K?????N?? flush() ???????????????? ????f?[?^???o??????????????????????B ?????????? ???????o?????? flush() ?????B
    void
    ?V????G???g???????????????????X?g???[?????????????B
    ?}?????\?b?h?? ???????k???????G???g?????????? putNextEntryAlreadyCompressed(), ????????k???????????????? putNextEntryNotYetCompressed() ???????o???B
    ???k????????????????????A header.getCompressedSize()
    header.getOriginalSize()
    header.getCRC()
    ???????????????? LhaHeader.UNKNOWN ????????????????k?????????????????B
    void
    ???????k???????G???g?????????}?????????X?g???[?????????????B
    ???k???????????A?????????@?\???o?????????o???????o?????????B ???k?????f?[?^????????????A?????o?????????????????B
    void
    ????????k???????????G???g?????????}?????????X?g???[?????????????B
    header ?? OriginalSize, CompressedSize, CRC???w????????????????????????B
    void
    write(byte[] buffer)
    ???????G???g???? buffer?????e???S???????o???B
    void
    write(byte[] buffer, int index, int length)
    ???????G???g???? buffer?? index???? length?o?C?g???f?[?^???????o???B
    void
    write(int data)
    ???????G???g????1?o?C?g???f?[?^???????}???B

    Methods inherited from class java.io.OutputStream

    nullOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LhaOutputStream

      public LhaOutputStream(OutputStream out)
      out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?????????@?\???????????g?p?????B?}???????A ???k???f?[?^???????????????L???????????t?@?C???????k????????B
      ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
      Parameters:
      out - ???k?f?[?^???o???????X?g???[??
      See Also:
    • LhaOutputStream

      public LhaOutputStream(OutputStream out, Properties property)
      out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?????????@?\???????????g?p?????B?}???????A ???k???f?[?^???????????????L???????????t?@?C???????k????????B
      Parameters:
      out - ???k?f?[?^???o???????X?g???[??
      property - ?e???k?`?????????????????????????????????????v???p?e?B
      See Also:
    • LhaOutputStream

      public LhaOutputStream(OutputStream out, RandomAccessFile file)
      out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
      Parameters:
      out - ???k?f?[?^???o???????X?g???[??
      file - RandomAccessFile ???C???X?^???X?B
      • ???? close() ?????????????B
      • ?R???X?g???N?^?? mode ???? "rw" ?I?v?V???????g?p?????A ?????}?????????}?????o???????????????????C???X?^???X???????}???B
      ???????????????????B
      See Also:
    • LhaOutputStream

      public LhaOutputStream(OutputStream out, RandomAccessFile file, Properties property)
      out ?? ???k?f?[?^???o??????OutputStream???\?z?????B
      Parameters:
      out - ???k?f?[?^???o???????X?g???[??
      file - RandomAccessFile ???C???X?^???X?B
      • ???? close() ?????????????B
      • ?R???X?g???N?^?? mode ???? "rw" ?I?v?V???????g?p?????A ?????}?????????}?????o???????????????????C???X?^???X???????}???B
      ???????????????????B
      property - ?e???k?`?????????????????????????????????????v???p?e?B
      Throws:
      UnsupportedEncodingException - encode ???T?|?[?g???????????
      See Also:
  • Method Details

    • write

      public void write(int data) throws IOException
      ???????G???g????1?o?C?g???f?[?^???????}???B
      Specified by:
      write in class OutputStream
      Parameters:
      data - ?????}???f?[?^
      Throws:
      IOException - ???o???G???[??????????????B
    • write

      public void write(byte[] buffer) throws IOException
      ???????G???g???? buffer?????e???S???????o???B
      Overrides:
      write in class OutputStream
      Parameters:
      buffer - ?????o???f?[?^?????????o?C?g?z??
      Throws:
      IOException - ???o???G???[??????????????B
    • write

      public void write(byte[] buffer, int index, int length) throws IOException
      ???????G???g???? buffer?? index???? length?o?C?g???f?[?^???????o???B
      Overrides:
      write in class OutputStream
      Parameters:
      buffer - ?????o???f?[?^?????????o?C?g?z??
      index - buffer?????????o???~???f?[?^???J?n???u
      length - ?f?[?^???o?C?g??
      Throws:
      IOException - ???o???G???[??????????????B
    • flush

      public void flush() throws IOException
      flush ???????????????s???B ???????????????????????G???g?????f?[?^?? ?????????@?\???????}?????????w???????B ?}???? PostLzssDecoder?ALzssOutputStream ???K?????N?? flush() ???????????????? ????f?[?^???o??????????????????????B ?????????? ???????o?????? flush() ?????B
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException - ???o???G???[?????????????
      See Also:
    • close

      public void close() throws IOException
      ?o???????S?????f?[?^???o?????A ?X?g???[??????????B
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - ???o???G???[?????????????
    • putNextEntry

      public void putNextEntry(LhaHeader header) throws IOException
      ?V????G???g???????????????????X?g???[?????????????B
      ?}?????\?b?h?? ???????k???????G???g?????????? putNextEntryAlreadyCompressed(), ????????k???????????????? putNextEntryNotYetCompressed() ???????o???B
      ???k????????????????????A
      • header.getCompressedSize()
      • header.getOriginalSize()
      • header.getCRC()
      ???????????????? LhaHeader.UNKNOWN ????????????????k?????????????????B
      Parameters:
      header - ?????}???G???g????????????????????? LhaHeader???C???X?^???X?B
      Throws:
      IOException - ???o???G???[?????????????
    • putNextEntryAlreadyCompressed

      public void putNextEntryAlreadyCompressed(LhaHeader header) throws IOException
      ???????k???????G???g?????????}?????????X?g???[?????????????B
      ???k???????????A?????????@?\???o?????????o???????o?????????B ???k?????f?[?^????????????A?????o?????????????????B
      Parameters:
      header - ?????}???G???g????????????????????? LhaHeader???C???X?^???X?B
      Throws:
      IOException - ???o???G???[?????????????
      IllegalArgumentException -
      1. header.getOriginalSize() ?? LhaHeader.UNKNOWN ??????????
      2. header.getComressedSize() ?? LhaHeader.UNKNOWN ??????????
      3. header.getCRC() ?? LhaHeader.UNKNOWN ??????????
      ?????????B
    • putNextEntryNotYetCompressed

      public void putNextEntryNotYetCompressed(LhaHeader header) throws IOException
      ????????k???????????G???g?????????}?????????X?g???[?????????????B
      header ?? OriginalSize, CompressedSize, CRC???w????????????????????????B
      Parameters:
      header - ?????}???G???g????????????????????? LhaHeader???C???X?^???X?B
      Throws:
      IOException - ???o???G???[?????????????
    • closeEntry

      public void closeEntry() throws IOException
      ?????o???????G???g????????A?????G???g?????o?????\?????????????B ???k?????s????(???k???T?C?Y?????k?O?T?C?Y??????????)?????A ???????????k???i?[?????B?G???g?????T?C?Y????????????A ?}???????????????????????????????B
      Throws:
      IOException - ???o???G???[?????????????