Package com.fastasyncworldedit.core.util
Class MainUtil
java.lang.Object
com.fastasyncworldedit.core.util.MainUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckImageHost(URI uri) static voidchunkTaskSync(RegionWrapper region, RunnableVal<int[]> task) The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunkstatic byte[]compress(byte[] bytes, byte[] buffer, int level) static intcompress(byte[] bytes, int length, byte[] buffer, OutputStream out, Deflater deflate) static Filestatic Filestatic Filestatic Objectstatic byte[]decompress(byte[] bytes, byte[] buffer, int length, int level) static voiddeleteOlder(File directory, long timeDiff, boolean printDebug) static voidstatic FaweInputStreamstatic FaweInputStreamgetCompressedIS(InputStream is, int buffer) static FaweOutputStreamgetCompressedOS(OutputStream os, int amount) static FaweOutputStreamgetCompressedOS(OutputStream os, int amount, int buffer) Note: The returned stream is not thread safe.static Filestatic Filestatic Filestatic FilegetJarFile(Class<?> clazz) static intgetMaxCompressedLength(int size) static intgetMaxFileId(File folder) static longstatic Stringstatic Thread[]static longgetTotalSize(Path path) static booleanisInSubDirectory(File dir, File file) static voiditerateFiles(File directory, Consumer<File> task) static BufferedImagestatic BufferedImagereadImage(InputStream stream) static BufferedImagestatic InputStreamreadImageStream(URI uri) static int[]regionNameToCoords(String fileName) static Stringrelativize(String path) static Fileresolve(File dir, String filename, ClipboardFormat format, boolean allowDir) static FileresolveRelative(File file) static StringsecToTime(long time) static CompoundTagsetEntityInfo(CompoundTag tag, Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.static CompoundTagsetPosition(CompoundTag tag, int x, int y, int z) Deprecated, for removal: This API element is subject to removal in a future version.static longstatic BufferedImagetoRGB(BufferedImage src) static voidtraverse(Path path, BiConsumer<Path, BasicFileAttributes> onEach) static URLupload(String urlStr, boolean save, String uuid, String file, String extension, RunnableVal<OutputStream> writeTask) static URLupload(UUID uuid, String file, String extension, RunnableVal<OutputStream> writeTask)
-
Constructor Details
-
MainUtil
public MainUtil()
-
-
Method Details
-
filter
-
getTotalSize
-
traverse
-
resolveRelative
-
relativize
-
getMaxFileId
-
getFile
-
getFile
-
getSize
-
getCompressedOS
- Throws:
IOException
-
getMaxCompressedLength
public static int getMaxCompressedLength(int size) -
compress
public static int compress(byte[] bytes, int length, byte[] buffer, OutputStream out, Deflater deflate) throws IOException - Throws:
IOException
-
compress
public static byte[] compress(byte[] bytes, byte[] buffer, int level) -
decompress
public static byte[] decompress(byte[] bytes, byte[] buffer, int length, int level) -
getCompressedOS
public static FaweOutputStream getCompressedOS(OutputStream os, int amount, int buffer) throws IOException Note: The returned stream is not thread safe.- Throws:
IOException
-
getCompressedIS
- Throws:
IOException
-
getCompressedIS
- Throws:
IOException
-
upload
public static URL upload(UUID uuid, String file, String extension, @Nonnull RunnableVal<OutputStream> writeTask) -
upload
public static URL upload(String urlStr, boolean save, String uuid, String file, String extension, @Nonnull RunnableVal<OutputStream> writeTask) -
setPosition
@Nonnull @Deprecated(forRemoval=true, since="2.11.2") public static CompoundTag setPosition(@Nonnull CompoundTag tag, int x, int y, int z) Deprecated, for removal: This API element is subject to removal in a future version.Create a copy of the tag and modify the (x, y, z) coordinates- Parameters:
tag- Tag to copyx- New X coordinatey- New Y coordinatez- New Z coordinate- Returns:
- New tag
-
setEntityInfo
@Nonnull @Deprecated(forRemoval=true, since="2.11.2") public static CompoundTag setEntityInfo(@Nonnull CompoundTag tag, @Nonnull Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.useNbtUtils.withEntityInfo(LinCompoundTag, Entity)insteadCreate a copy of the tag and modify the entity inf- Parameters:
tag- Tag to copyentity- Entity- Returns:
- New tag
-
getText
- Throws:
IOException
-
download
- Throws:
IOException
-
getJarFile
-
getJarFile
-
getThreads
-
copyFile
- Throws:
IOException
-
readImage
- Throws:
IOException
-
readImage
- Throws:
IOException
-
readImageStream
- Throws:
IOException
-
readImage
- Throws:
IOException
-
checkImageHost
- Throws:
IOException
-
toRGB
-
copyFile
-
copyFile
-
regionNameToCoords
-
resolve
public static File resolve(File dir, String filename, @Nullable ClipboardFormat format, boolean allowDir) -
isInSubDirectory
- Throws:
IOException
-
iterateFiles
-
chunkTaskSync
The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunk -
copyNd
-
secToTime
-
timeToSec
-
deleteOlder
-
NbtUtils.withEntityInfo(LinCompoundTag, Entity)instead