Package com.yetnt.utils.io
Record Class JarPath
java.lang.Object
java.lang.Record
com.yetnt.utils.io.JarPath
- Record Components:
path- The path in the resources folder to this file.
basically a String except this has a
readAs(Class, Function) and read(Class, Consumer) methods such as to
allow Class.getResourceAsStream(String) reading via an anonymous function.
From J3Engine
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.voidread(Class<?> relative, Consumer<InputStream> func) Reads the file with the given function<T> TreadAs(Class<?> relative, Function<InputStream, T> func) Reads the file with the given function and returns a resultfinal StringtoString()Returns a string representation of this record class.
-
Field Details
-
path
The field for thepathrecord component.
-
-
Constructor Details
-
JarPath
Creates an instance of aJarPathrecord class.- Parameters:
path- the value for thepathrecord component
-
-
Method Details
-
readAs
Reads the file with the given function and returns a result- Type Parameters:
T- The type of the result returned by the reader func- Parameters:
relative- The class whose project resources should be readfunc- The function to read the file and return a result.- Returns:
- The result returned by the reader func
- Throws:
IOException- if any Io shit happens
-
read
Reads the file with the given function- Parameters:
relative- The class whose project resources should be readfunc- The function to read the file.- Throws:
IOException- if any Io shit happens
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-