Class TextureUtils.TextureCopier

java.lang.Object
net.mtrop.doom.util.TextureUtils.TextureCopier
All Implemented Interfaces:
AutoCloseable
Enclosing class:
TextureUtils

public static class TextureUtils.TextureCopier extends Object implements AutoCloseable
A texture copying context for copying one or more textures to another Wad. This does the copying of both flats and textures.
Since:
2.6.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Commits the destination texture set to the destination Wad.
    boolean
    copyFlat(String flatName)
    Copies one flat from the source Wad to the destination Wad.
    boolean
    copyFlat(String flatName, boolean force)
    Copies one flat from the source Wad to the destination Wad.
    boolean
    copyTexture(String textureName)
    Copies one texture from the source Wad to the destination Wad, and copies the associated patch entries from the source Wad to the destination Wad, if they exist in the source.
    boolean
    copyTexture(String textureName, boolean force)
    Copies one texture from the source Wad to the destination Wad, and copies the associated patch entries from the source Wad to the destination Wad, if they exist in the source.
    boolean
    copyTexture(String textureName, boolean force, boolean replace)
    Copies one texture from the source Wad to the destination Wad, and copies the associated patch entries from the source Wad to the destination Wad, if they exist in the source.
    void
    ignoreFlat(String flatName)
    Adds a flat to the list of "already copied" flats, as though it already exists in the destination.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • copyFlat

      public boolean copyFlat(String flatName) throws IOException
      Copies one flat from the source Wad to the destination Wad. This will not re-copy flats that already exist (by name) in the destination Wad.

      If the flat start/end namespace markers do not exist in the destination Wad, they will be created: F_START and F_END if IWAD, FF_START and FF_END if PWAD.

      An error will occur if either Wad is closed (mostly WadFiles) when this is called.

      This does not pay attention to ANIMATED entries! Those will have to be moved separately!

      This is completely equivalent to copyFlat(flatName, false)

      Parameters:
      flatName - the name of the flat to copy over.
      Returns:
      true if the flat was copied over, false if the flat name was not found in the source, or it already existed in the destination.
      Throws:
      IOException - if a read or write error occurs.
      IllegalArgumentException - if flatName is not a valid entry name.
    • copyFlat

      public boolean copyFlat(String flatName, boolean force) throws IOException
      Copies one flat from the source Wad to the destination Wad. This will not re-copy flats that already exist (by name) in the destination Wad.

      If the flat start/end namespace markers do not exist in the destination Wad, they will be created: F_START and F_END if IWAD, FF_START and FF_END if PWAD.

      An error will occur if either Wad is closed (mostly WadFiles) when this is called.

      This does not pay attention to ANIMATED entries! Those will have to be moved separately!

      Parameters:
      flatName - the name of the flat to copy over.
      force - if true, this will not check for flats that already exist (by name) in the destination Wad, and copy anyway.
      Returns:
      true if the flat was copied over, false if the flat name was not found in the source, or it already existed in the destination.
      Throws:
      IOException - if a read or write error occurs.
      IllegalArgumentException - if flatName is not a valid entry name.
      Since:
      2.6.0
    • ignoreFlat

      public void ignoreFlat(String flatName)
      Adds a flat to the list of "already copied" flats, as though it already exists in the destination.
      Parameters:
      flatName - the name of the flat.
      Throws:
      IllegalArgumentException - if flatName is not a valid entry name.
      Since:
      2.10.0
    • copyTexture

      public boolean copyTexture(String textureName) throws IOException
      Copies one texture from the source Wad to the destination Wad, and copies the associated patch entries from the source Wad to the destination Wad, if they exist in the source. This will not re-copy patches that already exist (by name) in the destination Wad.

      If the TEXTUREx/PNAMES entries do not exist in the destination Wad, blank ones will be prepared (and written on close).

      If the patch start/end namespace markers do not exist in the destination Wad, they will be created: P_START and P_END if IWAD, PP_START and PP_END if PWAD.

      An error will occur if either Wad is closed (mostly WadFiles) when this is called.

      This does not pay attention to ANIMATED or SWITCHES entries! Those will have to be moved separately!

      This is completely equivalent to copyTexture(textureName, false)

      Parameters:
      textureName - the name of the texture to copy over.
      Returns:
      true if the texture was copied over, false if the texture name was not found in the source, or it already existed in the destination.
      Throws:
      IOException - if a read or write error occurs.
    • copyTexture

      public boolean copyTexture(String textureName, boolean force) throws IOException
      Copies one texture from the source Wad to the destination Wad, and copies the associated patch entries from the source Wad to the destination Wad, if they exist in the source.

      If the TEXTUREx/PNAMES entries do not exist in the destination Wad, blank ones will be prepared (and written on close).

      If the patch start/end namespace markers do not exist in the destination Wad, they will be created: P_START and P_END if IWAD, PP_START and PP_END if PWAD.

      An error will occur if either Wad is closed (mostly WadFiles) when this is called.

      This does not pay attention to ANIMATED or SWITCHES entries! Those will have to be moved separately!

      Parameters:
      textureName - the name of the texture to copy over.
      force - if true, this will not check for textures that already exist (by name) in the destination Wad, and copy it and its patches anyway.
      Returns:
      true if the texture was copied over, false if the texture name was not found in the source, or it already existed in the destination.
      Throws:
      IOException - if a read or write error occurs.
      Since:
      2.6.0
    • copyTexture

      public boolean copyTexture(String textureName, boolean force, boolean replace) throws IOException
      Copies one texture from the source Wad to the destination Wad, and copies the associated patch entries from the source Wad to the destination Wad, if they exist in the source.

      If the TEXTUREx/PNAMES entries do not exist in the destination Wad, blank ones will be prepared (and written on close).

      If the patch start/end namespace markers do not exist in the destination Wad, they will be created: P_START and P_END if IWAD, PP_START and PP_END if PWAD.

      An error will occur if either Wad is closed (mostly WadFiles) when this is called.

      This does not pay attention to ANIMATED or SWITCHES entries! Those will have to be moved separately!

      Parameters:
      textureName - the name of the texture to copy over.
      force - if true, this will not check for textures that already exist (by name) in the destination Wad, and copy it and its patches anyway.
      replace - if true, and force is true, then the texture of the same name in the destination is deleted first (BUT NOT PATCHES).
      Returns:
      true if the texture was copied over, false if the texture name was not found in the source, or it already existed in the destination.
      Throws:
      IOException - if a read or write error occurs.
      Since:
      2.10.0
    • close

      public void close() throws IOException
      Commits the destination texture set to the destination Wad. This will replace TEXTURE1/2 and PNAMES in the destination.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException - if a write error occurs.