diff options
author | Mike Mazur | 2009-03-12 06:03:59 +0000 |
---|---|---|
committer | Mike Mazur | 2009-03-12 06:03:59 +0000 |
commit | f784620780e7364d10bb821719eb684eed3b4903 (patch) | |
tree | cc4a5d2af1fb69017be4b56b5966913283c7fb9d /OpenSim/Framework/Archive/TarArchiveWriter.cs | |
parent | Minor bug fix. Thanks daTwitch. (diff) | |
download | opensim-SC-f784620780e7364d10bb821719eb684eed3b4903.zip opensim-SC-f784620780e7364d10bb821719eb684eed3b4903.tar.gz opensim-SC-f784620780e7364d10bb821719eb684eed3b4903.tar.bz2 opensim-SC-f784620780e7364d10bb821719eb684eed3b4903.tar.xz |
Moving TarArchive to OpenSim.Framework.Archive
We now build OpenSim.Framework.Archive.dll which aims to contain code
used for archiving various things in OpenSim. Also remove trailing
whitespace.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Archive/TarArchiveWriter.cs (renamed from OpenSim/Region/CoreModules/World/Archiver/TarArchiveWriter.cs) | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveWriter.cs b/OpenSim/Framework/Archive/TarArchiveWriter.cs index 506fcc5..59198b8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveWriter.cs +++ b/OpenSim/Framework/Archive/TarArchiveWriter.cs | |||
@@ -30,7 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Text; | 31 | using System.Text; |
32 | 32 | ||
33 | namespace OpenSim.Region.CoreModules.World.Archiver | 33 | namespace OpenSim.Framework.Archive |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// Temporary code to produce a tar archive in tar v7 format | 36 | /// Temporary code to produce a tar archive in tar v7 format |
@@ -45,12 +45,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
45 | /// Binary writer for the underlying stream | 45 | /// Binary writer for the underlying stream |
46 | /// </summary> | 46 | /// </summary> |
47 | protected BinaryWriter m_bw; | 47 | protected BinaryWriter m_bw; |
48 | 48 | ||
49 | public TarArchiveWriter(Stream s) | 49 | public TarArchiveWriter(Stream s) |
50 | { | 50 | { |
51 | m_bw = new BinaryWriter(s); | 51 | m_bw = new BinaryWriter(s); |
52 | } | 52 | } |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Write a directory entry to the tar archive. We can only handle one path level right now! | 55 | /// Write a directory entry to the tar archive. We can only handle one path level right now! |
56 | /// </summary> | 56 | /// </summary> |
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
63 | 63 | ||
64 | WriteFile(dirName, new byte[0]); | 64 | WriteFile(dirName, new byte[0]); |
65 | } | 65 | } |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Write a file to the tar archive | 68 | /// Write a file to the tar archive |
69 | /// </summary> | 69 | /// </summary> |
@@ -83,9 +83,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
83 | { | 83 | { |
84 | if (filePath.Length > 100) | 84 | if (filePath.Length > 100) |
85 | WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L'); | 85 | WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L'); |
86 | 86 | ||
87 | char fileType; | 87 | char fileType; |
88 | 88 | ||
89 | if (filePath.EndsWith("/")) | 89 | if (filePath.EndsWith("/")) |
90 | { | 90 | { |
91 | fileType = '5'; | 91 | fileType = '5'; |
@@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
93 | else | 93 | else |
94 | { | 94 | { |
95 | fileType = '0'; | 95 | fileType = '0'; |
96 | } | 96 | } |
97 | 97 | ||
98 | WriteEntry(filePath, data, fileType); | 98 | WriteEntry(filePath, data, fileType); |
99 | } | 99 | } |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Finish writing the raw tar archive data to a stream. The stream will be closed on completion. | 102 | /// Finish writing the raw tar archive data to a stream. The stream will be closed on completion. |
103 | /// </summary> | 103 | /// </summary> |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
106 | public void Close() | 106 | public void Close() |
107 | { | 107 | { |
108 | //m_log.Debug("[TAR ARCHIVE WRITER]: Writing final consecutive 0 blocks"); | 108 | //m_log.Debug("[TAR ARCHIVE WRITER]: Writing final consecutive 0 blocks"); |
109 | 109 | ||
110 | // Write two consecutive 0 blocks to end the archive | 110 | // Write two consecutive 0 blocks to end the archive |
111 | byte[] finalZeroPadding = new byte[1024]; | 111 | byte[] finalZeroPadding = new byte[1024]; |
112 | m_bw.Write(finalZeroPadding); | 112 | m_bw.Write(finalZeroPadding); |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
133 | byte[] oBytes = m_asciiEncoding.GetBytes(oString); | 133 | byte[] oBytes = m_asciiEncoding.GetBytes(oString); |
134 | 134 | ||
135 | return oBytes; | 135 | return oBytes; |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// Write a particular entry | 139 | /// Write a particular entry |
@@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
211 | 211 | ||
212 | byte[] padding = new byte[paddingRequired]; | 212 | byte[] padding = new byte[paddingRequired]; |
213 | m_bw.Write(padding); | 213 | m_bw.Write(padding); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |