Class LhaRetainedOutputStream

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

public class LhaRetainedOutputStream extends OutputStream
???}??????RandomAccessFile?? ???k?f?[?^???o???????????????[?e?B???e?B?N???X?B
java.util.zip.ZipOutputStream ???????C???^?[?t?F?C?X???????????????????B
???k???s??( ???k???T?C?Y?????k?O?T?C?Y?????????????? )?????????????I???s???B ?i?????????????????????A?}???????????????N???X?????B?????????i???????????b???? ???????????????\???????????????????B(???????M?K?o?C?g?????f?[?^????????????) ?}??????????????????????????? LhaImmediateOutputStream???g?p?????}???B
?????AJDK 1.1 ???O???? RandomAccessFile ?? setLength ??????????????A ?????f?[?^?????????????f?[?^???????????????t?@?C???T?C?Y???????l?????}?????o??????B ?}???????_???????T?C?Y0???V????t?@?C?????J???????????????????????????????B
 -- revision history --
 $Log: LhaRetainedOutputStream.java,v $
 Revision 1.2  2002/12/11 02:25:14  dangan
 [bug fix]
     jdk1.2 ???R???p?C?????????????????????C???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.2 $
Author:
$Author: dangan $
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    void
    ?o???????S?????f?[?^???o?????A?X?g???[??????????B
    ?????A?g?p????????S???????\?[?X???????????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
    ?????????????????G???g?????f?[?^??????I???o???????????o???B ?}???? PostLzssEncoder, LzssOutputStream ???K?????N?? flush() ???????????????????????f?[?^???o???????B (???????????? ?P?????k???????????????????????B)
    void
    ?V????G???g???????????????????X?g???[?????????????B
    ?}?????\?b?h?? ???????k???????G???g?????????? putNextEntryAlreadyCompressed(), ????????k???????????????? putNextEntryNotYetCompressed() ???????o???B
    ???k????????????????????A header.getCompressedSize()
    header.getCRC()
    ???????????????? LhaHeader.UNKNOWN ????????????????k?????????????????B
    header ???????m?? OriginalSize ???w????????????K?v???????B
    void
    ???????k???????G???g?????????}?????????X?g???[?????????????B
    ???k?????f?[?^????????????A?????o?????????????????B
    void
    ????????k???????????G???g?????????}?????????X?g???[?????????????B
    header ???????m?? OriginalSize ???w????????????K?v???????B
    header ?? 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

    • LhaRetainedOutputStream

      public LhaRetainedOutputStream(String filename) throws FileNotFoundException
      filename ???t?@?C???? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
      Parameters:
      filename - ???k?f?[?^???????}???t?@?C???????O
      Throws:
      FileNotFoundException - filename ???^?????????t?@?C????????????????????B
      SecurityException - ?Z?L?????e?B?}?l?[?W?????t?@?C???????A?N?Z?X??????????????B
      See Also:
    • LhaRetainedOutputStream

      public LhaRetainedOutputStream(String filename, Properties property) throws FileNotFoundException
      filename ???t?@?C???? ???k?f?[?^???o??????OutputStream???\?z?????B
      Parameters:
      filename - ???k?f?[?^???????}???t?@?C???????O
      property - ?e???k?`?????????????????????????????????????v???p?e?B
      Throws:
      FileNotFoundException - filename ???^?????????t?@?C????????????????????B
      SecurityException - ?Z?L?????e?B?}?l?[?W?????t?@?C???????A?N?Z?X??????????????B
      See Also:
    • LhaRetainedOutputStream

      public LhaRetainedOutputStream(File filename) throws IOException
      filename ???t?@?C???? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
      Parameters:
      filename - ???k?f?[?^???????}???t?@?C???????O
      Throws:
      FileNotFoundException - filename ???^?????????t?@?C????????????????????B
      SecurityException - ?Z?L?????e?B?}?l?[?W?????t?@?C???????A?N?Z?X??????????????B
      IOException - JDK1.2 ???R???p?C????????????????????????B
      See Also:
    • LhaRetainedOutputStream

      public LhaRetainedOutputStream(File filename, Properties property) throws IOException
      filename ???t?@?C???? ???k?f?[?^???o??????OutputStream???\?z?????B
      Parameters:
      filename - ???k?f?[?^???????}???t?@?C???????O
      property - ?e???k?`?????????????????????????????????????v???p?e?B
      Throws:
      FileNotFoundException - filename ???^?????????t?@?C????????????????????B
      SecurityException - ?Z?L?????e?B?}?l?[?W?????t?@?C???????A?N?Z?X??????????????B
      IOException - JDK1.2 ???R???p?C????????????????????????B
      See Also:
    • LhaRetainedOutputStream

      public LhaRetainedOutputStream(RandomAccessFile file)
      file?? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
      Parameters:
      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:
    • LhaRetainedOutputStream

      public LhaRetainedOutputStream(RandomAccessFile file, Properties property)
      file?? ???k?f?[?^???o??????OutputStream???\?z?????B
      ?e???k?`?????????????????????????????????v???p?e?B???? LhaProperty.getProperties() ???????????v???p?e?B???g?p???????B
      Parameters:
      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
      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
      ?????????????????G???g?????f?[?^??????I???o???????????o???B ?}???? PostLzssEncoder, LzssOutputStream ???K?????N?? flush() ???????????????????????f?[?^???o???????B (???????????? ?P?????k???????????????????????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
      ?????A?g?p????????S???????\?[?X???????????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.getCRC()
      ???????????????? LhaHeader.UNKNOWN ????????????????k?????????????????B
      header ???????m?? OriginalSize ???w????????????K?v???????B
      Parameters:
      header - ?????}???G???g????????????????????? LhaHeader???C???X?^???X?B
      Throws:
      IOException - ???o???G???[?????????????
      IllegalArgumentException - header.getOriginalSize() ?? LhaHeader.UNKNOWN ??????????
    • putNextEntryAlreadyCompressed

      public void putNextEntryAlreadyCompressed(LhaHeader header) throws IOException
      ???????k???????G???g?????????}?????????X?g???[?????????????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 ???????m?? OriginalSize ???w????????????K?v???????B
      header ?? CompressedSize, CRC???w????????????????????????B
      Parameters:
      header - ?????}???G???g????????????????????? LhaHeader???C???X?^???X?B
      Throws:
      IOException - ???o???G???[?????????????
      IllegalArgumentException - header.getOriginalSize() ?? LhaHeader.UNKNOWN ??????????
    • 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???[?????????????