diff options
author | Justin Clarke Casey | 2008-07-12 18:54:21 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-07-12 18:54:21 +0000 |
commit | 4e7dd0d9193155b22f0d8da1e0758b39652f4c41 (patch) | |
tree | fd62e8770c678aac5829791c01be31161aa184e3 /OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs | |
parent | Patch #9146 (No Mantis) (diff) | |
download | opensim-SC-4e7dd0d9193155b22f0d8da1e0758b39652f4c41.zip opensim-SC-4e7dd0d9193155b22f0d8da1e0758b39652f4c41.tar.gz opensim-SC-4e7dd0d9193155b22f0d8da1e0758b39652f4c41.tar.bz2 opensim-SC-4e7dd0d9193155b22f0d8da1e0758b39652f4c41.tar.xz |
* Start compressing archives
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs index 1301eb3..afb0a91 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs | |||
@@ -79,21 +79,19 @@ namespace OpenSim.Region.Environment | |||
79 | } | 79 | } |
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// Write the raw tar archive data to a file | 82 | /// Write the raw tar archive data to a stream. The stream will be closed on completion. |
83 | /// </summary> | 83 | /// </summary> |
84 | /// <param name="s">Stream to which to write the data</param> | ||
84 | /// <returns></returns> | 85 | /// <returns></returns> |
85 | public void WriteTar(string archivePath) | 86 | public void WriteTar(Stream s) |
86 | { | 87 | { |
87 | BinaryWriter bw = new BinaryWriter(new FileStream(archivePath, FileMode.Create)); | 88 | BinaryWriter bw = new BinaryWriter(s); |
88 | 89 | ||
89 | foreach (string filePath in m_files.Keys) | 90 | foreach (string filePath in m_files.Keys) |
90 | { | 91 | { |
91 | byte[] header = new byte[512]; | 92 | byte[] header = new byte[512]; |
92 | byte[] data = m_files[filePath]; | 93 | byte[] data = m_files[filePath]; |
93 | 94 | ||
94 | //string filePath = "test.txt"; | ||
95 | //byte[] data = m_asciiEncoding.GetBytes("hello\n"); | ||
96 | |||
97 | // file path field (100) | 95 | // file path field (100) |
98 | byte[] nameBytes = m_asciiEncoding.GetBytes(filePath); | 96 | byte[] nameBytes = m_asciiEncoding.GetBytes(filePath); |
99 | int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length; | 97 | int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length; |
@@ -149,7 +147,6 @@ namespace OpenSim.Region.Environment | |||
149 | m_log.DebugFormat("[TAR ARCHIVE WRITER]: Decimal header checksum is {0}", checksum); | 147 | m_log.DebugFormat("[TAR ARCHIVE WRITER]: Decimal header checksum is {0}", checksum); |
150 | 148 | ||
151 | byte[] checkSumBytes = ConvertDecimalToPaddedOctalBytes(checksum, 6); | 149 | byte[] checkSumBytes = ConvertDecimalToPaddedOctalBytes(checksum, 6); |
152 | //byte[] checkSumBytes = m_asciiEncoding.GetBytes("007520"); | ||
153 | 150 | ||
154 | Array.Copy(checkSumBytes, 0, header, 148, 6); | 151 | Array.Copy(checkSumBytes, 0, header, 148, 6); |
155 | 152 | ||
@@ -176,6 +173,7 @@ namespace OpenSim.Region.Environment | |||
176 | byte[] finalZeroPadding = new byte[1024]; | 173 | byte[] finalZeroPadding = new byte[1024]; |
177 | bw.Write(finalZeroPadding); | 174 | bw.Write(finalZeroPadding); |
178 | 175 | ||
176 | bw.Flush(); | ||
179 | bw.Close(); | 177 | bw.Close(); |
180 | } | 178 | } |
181 | 179 | ||