Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
e310757e
Commit
e310757e
authored
6 years ago
by
Roman Shevchenko
Browse files
Options
Download
Email Patches
Plain Diff
[tests] migrating to Compressor API
parent
975c5ce4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
platform/testFramework/src/com/intellij/util/io/impl/DirectoryContentSpecImpl.kt
+5
-23
...src/com/intellij/util/io/impl/DirectoryContentSpecImpl.kt
with
5 additions
and
23 deletions
+5
-23
platform/testFramework/src/com/intellij/util/io/impl/DirectoryContentSpecImpl.kt
+
5
-
23
View file @
e310757e
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package
com.intellij.util.io.impl
import
com.intellij.openapi.util.io.FileUtil
import
com.intellij.openapi.vfs.CharsetToolkit
import
com.intellij.util.io.Compressor
import
com.intellij.util.io.DirectoryContentBuilder
import
com.intellij.util.io.DirectoryContentSpec
import
com.intellij.util.io.ZipUtil
import
org.junit.Assert.*
import
java.io.BufferedOutputStream
import
java.io.File
import
java.io.IOException
import
java.util.*
import
java.util.zip.ZipOutputStream
/**
* @author nik
*/
sealed
class
DirectoryContentSpecImpl
:
DirectoryContentSpec
{
}
sealed
class
DirectoryContentSpecImpl
:
DirectoryContentSpec
abstract
class
DirectorySpecBase
:
DirectoryContentSpecImpl
()
{
protected
val
children
:
LinkedHashMap
<
String
,
DirectoryContentSpecImpl
>
=
LinkedHashMap
<
String
,
DirectoryContentSpecImpl
>
()
protected
val
children
:
LinkedHashMap
<
String
,
DirectoryContentSpecImpl
>
=
LinkedHashMap
()
fun
addChild
(
name
:
String
,
spec
:
DirectoryContentSpecImpl
)
{
if
(
name
in
children
)
{
...
...
@@ -77,9 +61,7 @@ class ZipSpec : DirectorySpecBase() {
val
contentDir
=
FileUtil
.
createTempDirectory
(
"zip-content"
,
null
,
false
)
try
{
generateInDirectory
(
contentDir
)
ZipOutputStream
(
BufferedOutputStream
(
target
.
outputStream
())).
use
{
ZipUtil
.
addDirToZipRecursively
(
it
,
null
,
contentDir
,
""
,
null
,
null
)
}
Compressor
.
Zip
(
target
).
use
{
it
.
addDirectory
(
contentDir
)
}
}
finally
{
FileUtil
.
delete
(
contentDir
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment