id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
101,900
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/IOUtil.java
IOUtil.readSymbolDescriptions
public static List<SymbolDescription> readSymbolDescriptions() throws IOException { String filename = "importcategories.txt"; List<SymbolDescription> list = new ArrayList<>(); List<String[]> lines = readArray(filename); String category = ""; String subCategory = null; for (String[] array : lines) { if...
java
public static List<SymbolDescription> readSymbolDescriptions() throws IOException { String filename = "importcategories.txt"; List<SymbolDescription> list = new ArrayList<>(); List<String[]> lines = readArray(filename); String category = ""; String subCategory = null; for (String[] array : lines) { if...
[ "public", "static", "List", "<", "SymbolDescription", ">", "readSymbolDescriptions", "(", ")", "throws", "IOException", "{", "String", "filename", "=", "\"importcategories.txt\"", ";", "List", "<", "SymbolDescription", ">", "list", "=", "new", "ArrayList", "<>", "...
Reads a list of symbol descriptions @param filename @return list of SymbolDescriptions @throws IOException
[ "Reads", "a", "list", "of", "symbol", "descriptions" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/IOUtil.java#L414-L441
101,901
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/msdos/MSDOSHeader.java
MSDOSHeader.newInstance
public static MSDOSHeader newInstance(byte[] headerbytes, long peSigOffset) throws IOException { MSDOSHeader header = new MSDOSHeader(headerbytes, peSigOffset); header.read(); return header; }
java
public static MSDOSHeader newInstance(byte[] headerbytes, long peSigOffset) throws IOException { MSDOSHeader header = new MSDOSHeader(headerbytes, peSigOffset); header.read(); return header; }
[ "public", "static", "MSDOSHeader", "newInstance", "(", "byte", "[", "]", "headerbytes", ",", "long", "peSigOffset", ")", "throws", "IOException", "{", "MSDOSHeader", "header", "=", "new", "MSDOSHeader", "(", "headerbytes", ",", "peSigOffset", ")", ";", "header",...
Creates and returns an instance of the MSDOSHeader with the given bytes and the file offset of the PE signature. @param headerbytes the bytes that make up the MSDOSHeader @param peSigOffset file offset to the PE signature @return MSDOSHeader instance @throws IOException if header can not be read.
[ "Creates", "and", "returns", "an", "instance", "of", "the", "MSDOSHeader", "with", "the", "given", "bytes", "and", "the", "file", "offset", "of", "the", "PE", "signature", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/msdos/MSDOSHeader.java#L205-L210
101,902
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PESignature.java
PESignature.read
public void read() throws IOException { try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { // check that offset location is within the file throwIf(file.length() < PE_OFFSET_LOCATION); /* read pe signature offset at offset location */ byte[] offsetBytes = loadBytesSafely(PE_OFFSET_LOCATION, ...
java
public void read() throws IOException { try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { // check that offset location is within the file throwIf(file.length() < PE_OFFSET_LOCATION); /* read pe signature offset at offset location */ byte[] offsetBytes = loadBytesSafely(PE_OFFSET_LOCATION, ...
[ "public", "void", "read", "(", ")", "throws", "IOException", "{", "try", "(", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ")", "{", "// check that offset location is within the file", "throwIf", "(", "file", ".", "l...
Reads the PE signature and sets the peOffset. @throws FileFormatException if file is not a PE file @throws IOException if something went wrong while trying to read the file
[ "Reads", "the", "PE", "signature", "and", "sets", "the", "peOffset", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PESignature.java#L84-L104
101,903
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PESignature.java
PESignature.exists
public boolean exists() { try { read(); return true; } catch (FileFormatException e) { return false; } catch (IOException e) { logger.error(e); return false; } }
java
public boolean exists() { try { read(); return true; } catch (FileFormatException e) { return false; } catch (IOException e) { logger.error(e); return false; } }
[ "public", "boolean", "exists", "(", ")", "{", "try", "{", "read", "(", ")", ";", "return", "true", ";", "}", "catch", "(", "FileFormatException", "e", ")", "{", "return", "false", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", ...
Tries to read the PE signature of the current file and returns true, iff it was successfull. @return true if the file has the PE signature, false otherwise.
[ "Tries", "to", "read", "the", "PE", "signature", "of", "the", "current", "file", "and", "returns", "true", "iff", "it", "was", "successfull", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PESignature.java#L193-L203
101,904
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PESignature.java
PESignature.getInfo
public String getInfo() { if (!peOffset.isPresent()) { return "No PE signature found"; } return "-------------" + NL + "PE Signature" + NL + "-------------" + NL + "pe offset: " + peOffset.get() + NL; }
java
public String getInfo() { if (!peOffset.isPresent()) { return "No PE signature found"; } return "-------------" + NL + "PE Signature" + NL + "-------------" + NL + "pe offset: " + peOffset.get() + NL; }
[ "public", "String", "getInfo", "(", ")", "{", "if", "(", "!", "peOffset", ".", "isPresent", "(", ")", ")", "{", "return", "\"No PE signature found\"", ";", "}", "return", "\"-------------\"", "+", "NL", "+", "\"PE Signature\"", "+", "NL", "+", "\"-----------...
Returns a description string. @return description string of the pe signature
[ "Returns", "a", "description", "string", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PESignature.java#L235-L241
101,905
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/Overlay.java
Overlay.getOffset
public long getOffset() throws IOException { if (offset == null) { read(); SectionTable table = data.getSectionTable(); SectionLoader loader = new SectionLoader(data); offset = 0L; List<SectionHeader> headers = table.getSectionHeaders(); //...
java
public long getOffset() throws IOException { if (offset == null) { read(); SectionTable table = data.getSectionTable(); SectionLoader loader = new SectionLoader(data); offset = 0L; List<SectionHeader> headers = table.getSectionHeaders(); //...
[ "public", "long", "getOffset", "(", ")", "throws", "IOException", "{", "if", "(", "offset", "==", "null", ")", "{", "read", "(", ")", ";", "SectionTable", "table", "=", "data", ".", "getSectionTable", "(", ")", ";", "SectionLoader", "loader", "=", "new",...
Returns the file offset of the overlay. @return file offset of the overlay @throws IOException
[ "Returns", "the", "file", "offset", "of", "the", "overlay", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/Overlay.java#L76-L105
101,906
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/Overlay.java
Overlay.dumpTo
public boolean dumpTo(File outFile) throws IOException { if (exists()) { dump(getOffset(), outFile); return true; } else { return false; } }
java
public boolean dumpTo(File outFile) throws IOException { if (exists()) { dump(getOffset(), outFile); return true; } else { return false; } }
[ "public", "boolean", "dumpTo", "(", "File", "outFile", ")", "throws", "IOException", "{", "if", "(", "exists", "(", ")", ")", "{", "dump", "(", "getOffset", "(", ")", ",", "outFile", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false...
Writes a dump of the overlay to the specified output location. @param outFile the file to write the dump to @return true iff successfully dumped @throws IOException if unable to read the input file or write the output file
[ "Writes", "a", "dump", "of", "the", "overlay", "to", "the", "specified", "output", "location", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/Overlay.java#L137-L144
101,907
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/Overlay.java
Overlay.dump
private void dump(long offset, File outFile) throws IOException { try (RandomAccessFile raf = new RandomAccessFile(file, "r"); FileOutputStream out = new FileOutputStream(outFile)) { raf.seek(offset); byte[] buffer = new byte[2048]; int bytesRead; ...
java
private void dump(long offset, File outFile) throws IOException { try (RandomAccessFile raf = new RandomAccessFile(file, "r"); FileOutputStream out = new FileOutputStream(outFile)) { raf.seek(offset); byte[] buffer = new byte[2048]; int bytesRead; ...
[ "private", "void", "dump", "(", "long", "offset", ",", "File", "outFile", ")", "throws", "IOException", "{", "try", "(", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "FileOutputStream", "out", "=", "new", ...
Dumps the last part of the file beginning at the specified offset. @param offset @throws IOException
[ "Dumps", "the", "last", "part", "of", "the", "file", "beginning", "at", "the", "specified", "offset", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/Overlay.java#L152-L162
101,908
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/Overlay.java
Overlay.getDump
public byte[] getDump() throws IOException { byte[] dump = new byte[(int) getSize()]; try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { raf.seek(offset); raf.readFully(dump); } return dump; }
java
public byte[] getDump() throws IOException { byte[] dump = new byte[(int) getSize()]; try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { raf.seek(offset); raf.readFully(dump); } return dump; }
[ "public", "byte", "[", "]", "getDump", "(", ")", "throws", "IOException", "{", "byte", "[", "]", "dump", "=", "new", "byte", "[", "(", "int", ")", "getSize", "(", ")", "]", ";", "try", "(", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "...
Loads all bytes of the overlay into an array and returns them. @return array containing the overlay bytes @throws IOException
[ "Loads", "all", "bytes", "of", "the", "overlay", "into", "an", "array", "and", "returns", "them", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/Overlay.java#L170-L177
101,909
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/FlagUtil.java
FlagUtil.getAllMatching
public static <T extends Characteristic> List<T> getAllMatching(long value, T[] flags) { List<T> list = new ArrayList<>(); // check every characteristic if it fits for (T ch : flags) { // read mask long mask = ch.getValue(); // use mask to check if...
java
public static <T extends Characteristic> List<T> getAllMatching(long value, T[] flags) { List<T> list = new ArrayList<>(); // check every characteristic if it fits for (T ch : flags) { // read mask long mask = ch.getValue(); // use mask to check if...
[ "public", "static", "<", "T", "extends", "Characteristic", ">", "List", "<", "T", ">", "getAllMatching", "(", "long", "value", ",", "T", "[", "]", "flags", ")", "{", "List", "<", "T", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "// c...
Returns a list of all flags, which are set in the value @param value @return list of all flags that are set
[ "Returns", "a", "list", "of", "all", "flags", "which", "are", "set", "in", "the", "value" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/FlagUtil.java#L35-L48
101,910
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.fileAligned
private long fileAligned(long value) { long fileAlign = optHeader.getAdjustedFileAlignment(); long rest = value % fileAlign; long result = value; if (rest != 0) { result = value - rest + fileAlign; } if (!(optHeader.isLowAlignmentMode() || result % 512 == 0)) ...
java
private long fileAligned(long value) { long fileAlign = optHeader.getAdjustedFileAlignment(); long rest = value % fileAlign; long result = value; if (rest != 0) { result = value - rest + fileAlign; } if (!(optHeader.isLowAlignmentMode() || result % 512 == 0)) ...
[ "private", "long", "fileAligned", "(", "long", "value", ")", "{", "long", "fileAlign", "=", "optHeader", ".", "getAdjustedFileAlignment", "(", ")", ";", "long", "rest", "=", "value", "%", "fileAlign", ";", "long", "result", "=", "value", ";", "if", "(", ...
Rounds up the value to the file alignment of the optional header. @param value @return file aligned value
[ "Rounds", "up", "the", "value", "to", "the", "file", "alignment", "of", "the", "optional", "header", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L170-L189
101,911
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.fileSizeAdjusted
private long fileSizeAdjusted(long alignedPointerToRaw, long readSize) { // end of section outside the file --> cut at file.length() if (readSize + alignedPointerToRaw > file.length()) { readSize = file.length() - alignedPointerToRaw; } // start of section outside the file --...
java
private long fileSizeAdjusted(long alignedPointerToRaw, long readSize) { // end of section outside the file --> cut at file.length() if (readSize + alignedPointerToRaw > file.length()) { readSize = file.length() - alignedPointerToRaw; } // start of section outside the file --...
[ "private", "long", "fileSizeAdjusted", "(", "long", "alignedPointerToRaw", ",", "long", "readSize", ")", "{", "// end of section outside the file --> cut at file.length()", "if", "(", "readSize", "+", "alignedPointerToRaw", ">", "file", ".", "length", "(", ")", ")", "...
Adjusts the readsize of a section to the size of the file. @param alignedPointerToRaw the file offset of the start of the section @param readSize the determined readsize without file adjustments @return adjusted readsize
[ "Adjusts", "the", "readsize", "of", "a", "section", "to", "the", "size", "of", "the", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L249-L260
101,912
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.maybeGetFileOffset
public Optional<Long> maybeGetFileOffset(long rva) { Optional<SectionHeader> section = maybeGetSectionHeaderByRVA(rva); // standard value if rva doesn't point into a section long fileOffset = rva; // rva is located within a section, so calculate offset if (section.isPresent()) { ...
java
public Optional<Long> maybeGetFileOffset(long rva) { Optional<SectionHeader> section = maybeGetSectionHeaderByRVA(rva); // standard value if rva doesn't point into a section long fileOffset = rva; // rva is located within a section, so calculate offset if (section.isPresent()) { ...
[ "public", "Optional", "<", "Long", ">", "maybeGetFileOffset", "(", "long", "rva", ")", "{", "Optional", "<", "SectionHeader", ">", "section", "=", "maybeGetSectionHeaderByRVA", "(", "rva", ")", ";", "// standard value if rva doesn't point into a section", "long", "fil...
Returns the file offset for the given RVA. Returns absent if file offset is not within file. @param rva the relative virtual address that shall be converted to a plain file offset @return file offset
[ "Returns", "the", "file", "offset", "for", "the", "given", "RVA", ".", "Returns", "absent", "if", "file", "offset", "is", "not", "within", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L342-L361
101,913
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.maybeGetSectionHeaderByRVA
public Optional<SectionHeader> maybeGetSectionHeaderByRVA(long rva) { List<SectionHeader> headers = table.getSectionHeaders(); for (SectionHeader header : headers) { VirtualLocation vLoc = getVirtualSectionLocation(header); if (addressIsWithin(vLoc, rva)) { return...
java
public Optional<SectionHeader> maybeGetSectionHeaderByRVA(long rva) { List<SectionHeader> headers = table.getSectionHeaders(); for (SectionHeader header : headers) { VirtualLocation vLoc = getVirtualSectionLocation(header); if (addressIsWithin(vLoc, rva)) { return...
[ "public", "Optional", "<", "SectionHeader", ">", "maybeGetSectionHeaderByRVA", "(", "long", "rva", ")", "{", "List", "<", "SectionHeader", ">", "headers", "=", "table", ".", "getSectionHeaders", "(", ")", ";", "for", "(", "SectionHeader", "header", ":", "heade...
Returns the section entry of the section table the rva is pointing into. @param rva the relative virtual address @return the {@link SectionHeader} of the section the rva is pointing into
[ "Returns", "the", "section", "entry", "of", "the", "section", "table", "the", "rva", "is", "pointing", "into", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L370-L379
101,914
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.maybeGetSectionHeaderByOffset
public Optional<SectionHeader> maybeGetSectionHeaderByOffset(long fileOffset) { List<SectionHeader> headers = table.getSectionHeaders(); for (SectionHeader header : headers) { PhysicalLocation loc = getPhysicalSectionLocation(header); if (addressIsWithin(loc, fileOffset)) { ...
java
public Optional<SectionHeader> maybeGetSectionHeaderByOffset(long fileOffset) { List<SectionHeader> headers = table.getSectionHeaders(); for (SectionHeader header : headers) { PhysicalLocation loc = getPhysicalSectionLocation(header); if (addressIsWithin(loc, fileOffset)) { ...
[ "public", "Optional", "<", "SectionHeader", ">", "maybeGetSectionHeaderByOffset", "(", "long", "fileOffset", ")", "{", "List", "<", "SectionHeader", ">", "headers", "=", "table", ".", "getSectionHeaders", "(", ")", ";", "for", "(", "SectionHeader", "header", ":"...
Returns the section entry of the section table the offset is pointing into. @param fileOffset the file offset @return the {@link SectionHeader} of the section the offset is pointing into
[ "Returns", "the", "section", "entry", "of", "the", "section", "table", "the", "offset", "is", "pointing", "into", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L390-L399
101,915
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.addressIsWithin
private static boolean addressIsWithin(Location location, long address) { long endpoint = location.from() + location.size(); return address >= location.from() && address < endpoint; }
java
private static boolean addressIsWithin(Location location, long address) { long endpoint = location.from() + location.size(); return address >= location.from() && address < endpoint; }
[ "private", "static", "boolean", "addressIsWithin", "(", "Location", "location", ",", "long", "address", ")", "{", "long", "endpoint", "=", "location", ".", "from", "(", ")", "+", "location", ".", "size", "(", ")", ";", "return", "address", ">=", "location"...
Returns true if the address is within the given location @param location @param address a address that may point into the section @return true iff address is within location
[ "Returns", "true", "if", "the", "address", "is", "within", "the", "given", "location" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L421-L424
101,916
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.getMemoryMappedPE
private MemoryMappedPE getMemoryMappedPE() { if (!memoryMapped.isPresent()) { memoryMapped = Optional.of(MemoryMappedPE.newInstance(data, this)); } return memoryMapped.get(); }
java
private MemoryMappedPE getMemoryMappedPE() { if (!memoryMapped.isPresent()) { memoryMapped = Optional.of(MemoryMappedPE.newInstance(data, this)); } return memoryMapped.get(); }
[ "private", "MemoryMappedPE", "getMemoryMappedPE", "(", ")", "{", "if", "(", "!", "memoryMapped", ".", "isPresent", "(", ")", ")", "{", "memoryMapped", "=", "Optional", ".", "of", "(", "MemoryMappedPE", ".", "newInstance", "(", "data", ",", "this", ")", ")"...
Creates new instance of MemoryMappedPE or just returns it, if it is already there. @return memory mapped PE
[ "Creates", "new", "instance", "of", "MemoryMappedPE", "or", "just", "returns", "it", "if", "it", "is", "already", "there", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L760-L765
101,917
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.maybeGetLoadInfo
private Optional<LoadInfo> maybeGetLoadInfo(DataDirectoryKey dataDirKey) { Optional<DataDirEntry> dirEntry = optHeader .maybeGetDataDirEntry(dataDirKey); if (dirEntry.isPresent()) { long virtualAddress = dirEntry.get().getVirtualAddress(); Optional<Long> maybeOffs...
java
private Optional<LoadInfo> maybeGetLoadInfo(DataDirectoryKey dataDirKey) { Optional<DataDirEntry> dirEntry = optHeader .maybeGetDataDirEntry(dataDirKey); if (dirEntry.isPresent()) { long virtualAddress = dirEntry.get().getVirtualAddress(); Optional<Long> maybeOffs...
[ "private", "Optional", "<", "LoadInfo", ">", "maybeGetLoadInfo", "(", "DataDirectoryKey", "dataDirKey", ")", "{", "Optional", "<", "DataDirEntry", ">", "dirEntry", "=", "optHeader", ".", "maybeGetDataDirEntry", "(", "dataDirKey", ")", ";", "if", "(", "dirEntry", ...
Assembles the loadInfo object for the dataDirKey. @param dataDirKey data directory key @return loading information
[ "Assembles", "the", "loadInfo", "object", "for", "the", "dataDirKey", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L774-L789
101,918
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.containsEntryPoint
@Beta public boolean containsEntryPoint(SectionHeader header) { long ep = data.getOptionalHeader().get( StandardFieldEntryKey.ADDR_OF_ENTRY_POINT); long vStart = header.getAlignedVirtualAddress(); long vSize = header.getAlignedVirtualSize(); if (vSize == 0) { ...
java
@Beta public boolean containsEntryPoint(SectionHeader header) { long ep = data.getOptionalHeader().get( StandardFieldEntryKey.ADDR_OF_ENTRY_POINT); long vStart = header.getAlignedVirtualAddress(); long vSize = header.getAlignedVirtualSize(); if (vSize == 0) { ...
[ "@", "Beta", "public", "boolean", "containsEntryPoint", "(", "SectionHeader", "header", ")", "{", "long", "ep", "=", "data", ".", "getOptionalHeader", "(", ")", ".", "get", "(", "StandardFieldEntryKey", ".", "ADDR_OF_ENTRY_POINT", ")", ";", "long", "vStart", "...
Returns whether the section contains the entry point of the file. @param header the header of the section that may contain the entry point. @return true if entry point is within the section, false otherwise
[ "Returns", "whether", "the", "section", "contains", "the", "entry", "point", "of", "the", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L881-L892
101,919
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/Hasher.java
Hasher.fileHash
public static byte[] fileHash(File file, MessageDigest messageDigest) throws IOException { return computeHash(file, messageDigest, 0L, file.length()); }
java
public static byte[] fileHash(File file, MessageDigest messageDigest) throws IOException { return computeHash(file, messageDigest, 0L, file.length()); }
[ "public", "static", "byte", "[", "]", "fileHash", "(", "File", "file", ",", "MessageDigest", "messageDigest", ")", "throws", "IOException", "{", "return", "computeHash", "(", "file", ",", "messageDigest", ",", "0L", ",", "file", ".", "length", "(", ")", ")...
Returns the hash value of the file for the specified messageDigest. @param file to compute the hash value for @param messageDigest the message digest algorithm @return hash value of the file @throws IOException
[ "Returns", "the", "hash", "value", "of", "the", "file", "for", "the", "specified", "messageDigest", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/Hasher.java#L126-L129
101,920
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.createEntropyImage
public BufferedImage createEntropyImage(File file) throws IOException { resetAvailabilityFlags(); this.data = new PEData(null, null, null, null, null, file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); final int MIN_WINDOW_SIZE = 100; // bytes to be read at once to calculate local entropy fina...
java
public BufferedImage createEntropyImage(File file) throws IOException { resetAvailabilityFlags(); this.data = new PEData(null, null, null, null, null, file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); final int MIN_WINDOW_SIZE = 100; // bytes to be read at once to calculate local entropy fina...
[ "public", "BufferedImage", "createEntropyImage", "(", "File", "file", ")", "throws", "IOException", "{", "resetAvailabilityFlags", "(", ")", ";", "this", ".", "data", "=", "new", "PEData", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",...
Creates an image of the local entropies of this file. @param file the PE file @return image of local entropies @throws IOException if file can not be read
[ "Creates", "an", "image", "of", "the", "local", "entropies", "of", "this", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L245-L274
101,921
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.getColorForEntropy
private Color getColorForEntropy(double entropy) { assert entropy <= 1; assert entropy >= 0; Color entropyColor = colorMap.get(ENTROPY); float[] hsbvals = new float[3]; Color.RGBtoHSB(entropyColor.getRed(), entropyColor.getGreen(), entropyColor.getBlue(), hsbvals); float entropyHue = hsbvals[0]; float...
java
private Color getColorForEntropy(double entropy) { assert entropy <= 1; assert entropy >= 0; Color entropyColor = colorMap.get(ENTROPY); float[] hsbvals = new float[3]; Color.RGBtoHSB(entropyColor.getRed(), entropyColor.getGreen(), entropyColor.getBlue(), hsbvals); float entropyHue = hsbvals[0]; float...
[ "private", "Color", "getColorForEntropy", "(", "double", "entropy", ")", "{", "assert", "entropy", "<=", "1", ";", "assert", "entropy", ">=", "0", ";", "Color", "entropyColor", "=", "colorMap", ".", "get", "(", "ENTROPY", ")", ";", "float", "[", "]", "hs...
Creates a color instance based on a given entropy. @param entropy value between 0 and 1 @return Color for given entropy
[ "Creates", "a", "color", "instance", "based", "on", "a", "given", "entropy", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L283-L296
101,922
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.writeImage
public void writeImage(File input, File output, String formatName) throws IOException { BufferedImage image = createImage(input); ImageIO.write(image, formatName, output); }
java
public void writeImage(File input, File output, String formatName) throws IOException { BufferedImage image = createImage(input); ImageIO.write(image, formatName, output); }
[ "public", "void", "writeImage", "(", "File", "input", ",", "File", "output", ",", "String", "formatName", ")", "throws", "IOException", "{", "BufferedImage", "image", "=", "createImage", "(", "input", ")", ";", "ImageIO", ".", "write", "(", "image", ",", "...
Writes an image to the output file that displays the structure of the PE file. @param input the PE file to create an image from @param output the file to write the image to @param formatName the format name for the output image @throws IOException if sections can not be read
[ "Writes", "an", "image", "to", "the", "output", "file", "that", "displays", "the", "structure", "of", "the", "PE", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L339-L343
101,923
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.createDiffImage
public BufferedImage createDiffImage(BufferedImage firstImage, BufferedImage secondImage) throws IOException { BufferedImage diffImage = new BufferedImage(firstImage.getWidth(), firstImage.getHeight(), IMAGE_TYPE); for (int x = 0; x < firstImage.getWidth() && x < secondImage.getWidth(); x++) { for (int y...
java
public BufferedImage createDiffImage(BufferedImage firstImage, BufferedImage secondImage) throws IOException { BufferedImage diffImage = new BufferedImage(firstImage.getWidth(), firstImage.getHeight(), IMAGE_TYPE); for (int x = 0; x < firstImage.getWidth() && x < secondImage.getWidth(); x++) { for (int y...
[ "public", "BufferedImage", "createDiffImage", "(", "BufferedImage", "firstImage", ",", "BufferedImage", "secondImage", ")", "throws", "IOException", "{", "BufferedImage", "diffImage", "=", "new", "BufferedImage", "(", "firstImage", ".", "getWidth", "(", ")", ",", "f...
Creates a buffered image containing the diff of both files. @param firstFile @param secondFile @return @throws IOException
[ "Creates", "a", "buffered", "image", "containing", "the", "diff", "of", "both", "files", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L353-L368
101,924
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.createImage
public BufferedImage createImage(File file) throws IOException { resetAvailabilityFlags(); this.data = PELoader.loadPE(file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); drawSections(); Overlay overlay = new Overlay(data); if (overlay.exists()) { long overlayOffset = overlay.getOffset(); ...
java
public BufferedImage createImage(File file) throws IOException { resetAvailabilityFlags(); this.data = PELoader.loadPE(file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); drawSections(); Overlay overlay = new Overlay(data); if (overlay.exists()) { long overlayOffset = overlay.getOffset(); ...
[ "public", "BufferedImage", "createImage", "(", "File", "file", ")", "throws", "IOException", "{", "resetAvailabilityFlags", "(", ")", ";", "this", ".", "data", "=", "PELoader", ".", "loadPE", "(", "file", ")", ";", "image", "=", "new", "BufferedImage", "(", ...
Creates a buffered image that displays the structure of the PE file. @param file the PE file to create an image from @return buffered image @throws IOException if sections can not be read
[ "Creates", "a", "buffered", "image", "that", "displays", "the", "structure", "of", "the", "PE", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L379-L401
101,925
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.createLegendImage
public BufferedImage createLegendImage(boolean withBytePlot, boolean withEntropy, boolean withPEStructure) { image = new BufferedImage(legendWidth, height, IMAGE_TYPE); drawLegend(withBytePlot, withEntropy, withPEStructure); assert image != null; assert image.getWidth() == legendWidth; assert image.getHeig...
java
public BufferedImage createLegendImage(boolean withBytePlot, boolean withEntropy, boolean withPEStructure) { image = new BufferedImage(legendWidth, height, IMAGE_TYPE); drawLegend(withBytePlot, withEntropy, withPEStructure); assert image != null; assert image.getWidth() == legendWidth; assert image.getHeig...
[ "public", "BufferedImage", "createLegendImage", "(", "boolean", "withBytePlot", ",", "boolean", "withEntropy", ",", "boolean", "withPEStructure", ")", "{", "image", "=", "new", "BufferedImage", "(", "legendWidth", ",", "height", ",", "IMAGE_TYPE", ")", ";", "drawL...
Creates a buffered image with a basic Legend @param withBytePlot show byteplot legend @param withEntropy show entropy legend @param withPEStructure show PE structure legend @return buffered image of the generated legend
[ "Creates", "a", "buffered", "image", "with", "a", "basic", "Legend" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L414-L422
101,926
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.drawPEHeaders
private void drawPEHeaders() { long msdosOffset = 0; long msdosSize = withMinLength(data.getMSDOSHeader().getHeaderSize()); drawPixels(colorMap.get(MSDOS_HEADER), msdosOffset, msdosSize); long optOffset = data.getOptionalHeader().getOffset(); long optSize = withMinLength(data.getOptionalHeader().getSize()); ...
java
private void drawPEHeaders() { long msdosOffset = 0; long msdosSize = withMinLength(data.getMSDOSHeader().getHeaderSize()); drawPixels(colorMap.get(MSDOS_HEADER), msdosOffset, msdosSize); long optOffset = data.getOptionalHeader().getOffset(); long optSize = withMinLength(data.getOptionalHeader().getSize()); ...
[ "private", "void", "drawPEHeaders", "(", ")", "{", "long", "msdosOffset", "=", "0", ";", "long", "msdosSize", "=", "withMinLength", "(", "data", ".", "getMSDOSHeader", "(", ")", ".", "getHeaderSize", "(", ")", ")", ";", "drawPixels", "(", "colorMap", ".", ...
Draws the PE Header to the structure image
[ "Draws", "the", "PE", "Header", "to", "the", "structure", "image" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L458-L477
101,927
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.getEntryPoint
private Optional<Long> getEntryPoint() { long rva = data.getOptionalHeader().get( StandardFieldEntryKey.ADDR_OF_ENTRY_POINT); Optional<SectionHeader> section = new SectionLoader(data) .maybeGetSectionHeaderByRVA(rva); if (section.isPresent()) { long phystovirt = section.get().get( SectionHeaderKey...
java
private Optional<Long> getEntryPoint() { long rva = data.getOptionalHeader().get( StandardFieldEntryKey.ADDR_OF_ENTRY_POINT); Optional<SectionHeader> section = new SectionLoader(data) .maybeGetSectionHeaderByRVA(rva); if (section.isPresent()) { long phystovirt = section.get().get( SectionHeaderKey...
[ "private", "Optional", "<", "Long", ">", "getEntryPoint", "(", ")", "{", "long", "rva", "=", "data", ".", "getOptionalHeader", "(", ")", ".", "get", "(", "StandardFieldEntryKey", ".", "ADDR_OF_ENTRY_POINT", ")", ";", "Optional", "<", "SectionHeader", ">", "s...
Returns the entry point of the PE if present and valid, otherwise absent. A valid entry point is one within a section. @return entry point optional if present, absent otherwise
[ "Returns", "the", "entry", "point", "of", "the", "PE", "if", "present", "and", "valid", "otherwise", "absent", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L572-L584
101,928
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.drawSections
private void drawSections() { SectionTable table = data.getSectionTable(); long sectionTableOffset = table.getOffset(); long sectionTableSize = table.getSize(); drawPixels(colorMap.get(SECTION_TABLE), sectionTableOffset, sectionTableSize); logger.info("x pixels: " + getXPixels()); logger.info("y pixels:...
java
private void drawSections() { SectionTable table = data.getSectionTable(); long sectionTableOffset = table.getOffset(); long sectionTableSize = table.getSize(); drawPixels(colorMap.get(SECTION_TABLE), sectionTableOffset, sectionTableSize); logger.info("x pixels: " + getXPixels()); logger.info("y pixels:...
[ "private", "void", "drawSections", "(", ")", "{", "SectionTable", "table", "=", "data", ".", "getSectionTable", "(", ")", ";", "long", "sectionTableOffset", "=", "table", ".", "getOffset", "(", ")", ";", "long", "sectionTableSize", "=", "table", ".", "getSiz...
Draw the sections to the structure image.
[ "Draw", "the", "sections", "to", "the", "structure", "image", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L589-L607
101,929
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.getSectionColor
private Color getSectionColor(SectionHeader header) { // color is based on section number int nr = header.getNumber(); Color sectionColor = colorMap.get(SECTION_START); // modify the color section number times for (int i = 1; i < nr; i++) { sectionColor = variate(sectionColor); } return sectionColor; ...
java
private Color getSectionColor(SectionHeader header) { // color is based on section number int nr = header.getNumber(); Color sectionColor = colorMap.get(SECTION_START); // modify the color section number times for (int i = 1; i < nr; i++) { sectionColor = variate(sectionColor); } return sectionColor; ...
[ "private", "Color", "getSectionColor", "(", "SectionHeader", "header", ")", "{", "// color is based on section number", "int", "nr", "=", "header", ".", "getNumber", "(", ")", ";", "Color", "sectionColor", "=", "colorMap", ".", "get", "(", "SECTION_START", ")", ...
Generate the color of the given section. @param header of the section @return color of the section
[ "Generate", "the", "color", "of", "the", "given", "section", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L616-L625
101,930
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.variate
private Color variate(Color color) { assert color != null; final int diff = 30; // darken the color for value of diff int newRed = shiftColorPart(color.getRed() - diff); int newGreen = shiftColorPart(color.getGreen() - diff); int newBlue = shiftColorPart(color.getBlue() - diff); Color newColor = new Color...
java
private Color variate(Color color) { assert color != null; final int diff = 30; // darken the color for value of diff int newRed = shiftColorPart(color.getRed() - diff); int newGreen = shiftColorPart(color.getGreen() - diff); int newBlue = shiftColorPart(color.getBlue() - diff); Color newColor = new Color...
[ "private", "Color", "variate", "(", "Color", "color", ")", "{", "assert", "color", "!=", "null", ";", "final", "int", "diff", "=", "30", ";", "// darken the color for value of diff", "int", "newRed", "=", "shiftColorPart", "(", "color", ".", "getRed", "(", "...
Shift the given section color one step. This creates a color similar to the given color, but still different enough to tell the new color apart from the old one. @param color @return modified color
[ "Shift", "the", "given", "section", "color", "one", "step", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L636-L650
101,931
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.drawRect
private void drawRect(Color color, int startX, int startY, int width, int height) { assert color != null; for (int x = startX; x < startX + width; x++) { for (int y = startY; y < startY + height; y++) { try { image.setRGB(x, y, color.getRGB()); } catch (ArrayIndexOutOfBoundsException e) { lo...
java
private void drawRect(Color color, int startX, int startY, int width, int height) { assert color != null; for (int x = startX; x < startX + width; x++) { for (int y = startY; y < startY + height; y++) { try { image.setRGB(x, y, color.getRGB()); } catch (ArrayIndexOutOfBoundsException e) { lo...
[ "private", "void", "drawRect", "(", "Color", "color", ",", "int", "startX", ",", "int", "startY", ",", "int", "width", ",", "int", "height", ")", "{", "assert", "color", "!=", "null", ";", "for", "(", "int", "x", "=", "startX", ";", "x", "<", "star...
Draws a rectangle. @param color that fills the rectangle @param startX the x value of the upper left corner for the rectangle @param startY the y value of the upper left corner for the rectangle @param width the width of the rectangle in pixels @param height the height of the rectangle in pixels
[ "Draws", "a", "rectangle", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L835-L847
101,932
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.drawCross
private void drawCross(Color color, int startX, int startY, int width, int height) { assert color != null; final int thickness = 2; for (int x = startX; x < startX + width; x++) { for (int y = startY; y < startY + height; y++) { try { if (Math.abs((x - startX) - (y - startY)) < thickness || ...
java
private void drawCross(Color color, int startX, int startY, int width, int height) { assert color != null; final int thickness = 2; for (int x = startX; x < startX + width; x++) { for (int y = startY; y < startY + height; y++) { try { if (Math.abs((x - startX) - (y - startY)) < thickness || ...
[ "private", "void", "drawCross", "(", "Color", "color", ",", "int", "startX", ",", "int", "startY", ",", "int", "width", ",", "int", "height", ")", "{", "assert", "color", "!=", "null", ";", "final", "int", "thickness", "=", "2", ";", "for", "(", "int...
Draws a cross. @param color of the cross @param startX the x value of the upper left corner for the cross @param startY the y value of the upper left corner for the cross @param width the width of the cross in pixels @param height the height of the cross in pixels
[ "Draws", "a", "cross", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L863-L879
101,933
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.drawPixel
private void drawPixel(Color color, long fileOffset) { long size = withMinLength(0); drawPixels(color, fileOffset, size); }
java
private void drawPixel(Color color, long fileOffset) { long size = withMinLength(0); drawPixels(color, fileOffset, size); }
[ "private", "void", "drawPixel", "(", "Color", "color", ",", "long", "fileOffset", ")", "{", "long", "size", "=", "withMinLength", "(", "0", ")", ";", "drawPixels", "(", "color", ",", "fileOffset", ",", "size", ")", ";", "}" ]
Draws a square pixel at fileOffset with color. @param color of the square pixel @param fileOffset file location that the square pixel represents
[ "Draws", "a", "square", "pixel", "at", "fileOffset", "with", "color", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L916-L919
101,934
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.getPixelNumber
private long getPixelNumber(long fileOffset) { assert fileOffset >= 0; long result = Math.round(fileOffset / bytesPerPixel()); assert result >= 0; return result; }
java
private long getPixelNumber(long fileOffset) { assert fileOffset >= 0; long result = Math.round(fileOffset / bytesPerPixel()); assert result >= 0; return result; }
[ "private", "long", "getPixelNumber", "(", "long", "fileOffset", ")", "{", "assert", "fileOffset", ">=", "0", ";", "long", "result", "=", "Math", ".", "round", "(", "fileOffset", "/", "bytesPerPixel", "(", ")", ")", ";", "assert", "result", ">=", "0", ";"...
convert fileOffset to square pixels
[ "convert", "fileOffset", "to", "square", "pixels" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L987-L992
101,935
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.bytesPerPixel
private int bytesPerPixel() { long fileSize = data.getFile().length(); long pixelMax = getXPixels() * (long) getYPixels(); // ceil result, because it is a maximum that we use to divide return (int) Math.ceil(fileSize / (double) pixelMax); }
java
private int bytesPerPixel() { long fileSize = data.getFile().length(); long pixelMax = getXPixels() * (long) getYPixels(); // ceil result, because it is a maximum that we use to divide return (int) Math.ceil(fileSize / (double) pixelMax); }
[ "private", "int", "bytesPerPixel", "(", ")", "{", "long", "fileSize", "=", "data", ".", "getFile", "(", ")", ".", "length", "(", ")", ";", "long", "pixelMax", "=", "getXPixels", "(", ")", "*", "(", "long", ")", "getYPixels", "(", ")", ";", "// ceil r...
Calculates how many bytes are covered by one square pixel. @return bytes covered by one square pixel
[ "Calculates", "how", "many", "bytes", "are", "covered", "by", "one", "square", "pixel", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L999-L1004
101,936
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PELoader.java
PELoader.loadData
private PEData loadData() throws IOException { PESignature pesig = new PESignature(file); pesig.read(); checkState(pesig.exists(), "no valid pe file, signature not found"); // read all headers try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { ...
java
private PEData loadData() throws IOException { PESignature pesig = new PESignature(file); pesig.read(); checkState(pesig.exists(), "no valid pe file, signature not found"); // read all headers try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { ...
[ "private", "PEData", "loadData", "(", ")", "throws", "IOException", "{", "PESignature", "pesig", "=", "new", "PESignature", "(", "file", ")", ";", "pesig", ".", "read", "(", ")", ";", "checkState", "(", "pesig", ".", "exists", "(", ")", ",", "\"no valid ...
Loads the PE file header data into a PEData instance. @return header data @throws IOException if file can not be read @throws IllegalStateException if no valid PE file
[ "Loads", "the", "PE", "file", "header", "data", "into", "a", "PEData", "instance", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PELoader.java#L86-L113
101,937
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PELoader.java
PELoader.loadMSDOSHeader
private MSDOSHeader loadMSDOSHeader(RandomAccessFile raf, long peSigOffset) throws IOException { byte[] headerbytes = loadBytesSafely(0, MSDOSHeader.FORMATTED_HEADER_SIZE, raf); return MSDOSHeader.newInstance(headerbytes, peSigOffset); }
java
private MSDOSHeader loadMSDOSHeader(RandomAccessFile raf, long peSigOffset) throws IOException { byte[] headerbytes = loadBytesSafely(0, MSDOSHeader.FORMATTED_HEADER_SIZE, raf); return MSDOSHeader.newInstance(headerbytes, peSigOffset); }
[ "private", "MSDOSHeader", "loadMSDOSHeader", "(", "RandomAccessFile", "raf", ",", "long", "peSigOffset", ")", "throws", "IOException", "{", "byte", "[", "]", "headerbytes", "=", "loadBytesSafely", "(", "0", ",", "MSDOSHeader", ".", "FORMATTED_HEADER_SIZE", ",", "r...
Loads the MSDOS header. @param raf the random access file instance @return msdos header @throws IOException if unable to read header
[ "Loads", "the", "MSDOS", "header", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PELoader.java#L187-L192
101,938
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PELoader.java
PELoader.loadSectionTable
private SectionTable loadSectionTable(PESignature pesig, COFFFileHeader coff, RandomAccessFile raf) throws IOException { // offset is the start of the optional header + SizeOfOptionalHeader long offset = pesig.getOffset() + PESignature.PE_SIG.length + COFFFileHeader.HEADER_SI...
java
private SectionTable loadSectionTable(PESignature pesig, COFFFileHeader coff, RandomAccessFile raf) throws IOException { // offset is the start of the optional header + SizeOfOptionalHeader long offset = pesig.getOffset() + PESignature.PE_SIG.length + COFFFileHeader.HEADER_SI...
[ "private", "SectionTable", "loadSectionTable", "(", "PESignature", "pesig", ",", "COFFFileHeader", "coff", ",", "RandomAccessFile", "raf", ")", "throws", "IOException", "{", "// offset is the start of the optional header + SizeOfOptionalHeader", "long", "offset", "=", "pesig"...
Loads the section table. Presumes a valid PE file. @param pesig pe signature @param coff coff file header @param raf the random access file instance @return section table @throws IOException if unable to read header
[ "Loads", "the", "section", "table", ".", "Presumes", "a", "valid", "PE", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PELoader.java#L207-L227
101,939
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PELoader.java
PELoader.loadCOFFFileHeader
private COFFFileHeader loadCOFFFileHeader(PESignature pesig, RandomAccessFile raf) throws IOException { // coff header starts right after the PE signature long offset = pesig.getOffset() + PESignature.PE_SIG.length; logger.info("COFF Header offset: " + offset); // read bytes,...
java
private COFFFileHeader loadCOFFFileHeader(PESignature pesig, RandomAccessFile raf) throws IOException { // coff header starts right after the PE signature long offset = pesig.getOffset() + PESignature.PE_SIG.length; logger.info("COFF Header offset: " + offset); // read bytes,...
[ "private", "COFFFileHeader", "loadCOFFFileHeader", "(", "PESignature", "pesig", ",", "RandomAccessFile", "raf", ")", "throws", "IOException", "{", "// coff header starts right after the PE signature", "long", "offset", "=", "pesig", ".", "getOffset", "(", ")", "+", "PES...
Loads the COFF File header. Presumes a valid PE file. @param pesig pe signature @param raf the random access file instance @return coff file header @throws IOException if unable to read header
[ "Loads", "the", "COFF", "File", "header", ".", "Presumes", "a", "valid", "PE", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PELoader.java#L240-L250
101,940
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/PELoader.java
PELoader.loadOptionalHeader
private OptionalHeader loadOptionalHeader(PESignature pesig, COFFFileHeader coff, RandomAccessFile raf) throws IOException { // offset right after the eCOFF File Header long offset = pesig.getOffset() + PESignature.PE_SIG.length + COFFFileHeader.HEADER_SIZE; logger.in...
java
private OptionalHeader loadOptionalHeader(PESignature pesig, COFFFileHeader coff, RandomAccessFile raf) throws IOException { // offset right after the eCOFF File Header long offset = pesig.getOffset() + PESignature.PE_SIG.length + COFFFileHeader.HEADER_SIZE; logger.in...
[ "private", "OptionalHeader", "loadOptionalHeader", "(", "PESignature", "pesig", ",", "COFFFileHeader", "coff", ",", "RandomAccessFile", "raf", ")", "throws", "IOException", "{", "// offset right after the eCOFF File Header", "long", "offset", "=", "pesig", ".", "getOffset...
Loads the optional header. Presumes a valid PE file. @param pesig pe signature @param coff coff file header @param raf the random access file instance @return optional header @throws IOException if unable to read header
[ "Loads", "the", "optional", "header", ".", "Presumes", "a", "valid", "PE", "file", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PELoader.java#L265-L276
101,941
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/optheader/DataDirEntry.java
DataDirEntry.getFileOffset
public long getFileOffset(SectionTable table) { checkArgument(table != null, "section table must not be null"); Optional<SectionHeader> section = maybeGetSectionTableEntry(table); if (section.isPresent()) { long sectionRVA = section.get().getAlignedVirtualAddress(); long...
java
public long getFileOffset(SectionTable table) { checkArgument(table != null, "section table must not be null"); Optional<SectionHeader> section = maybeGetSectionTableEntry(table); if (section.isPresent()) { long sectionRVA = section.get().getAlignedVirtualAddress(); long...
[ "public", "long", "getFileOffset", "(", "SectionTable", "table", ")", "{", "checkArgument", "(", "table", "!=", "null", ",", "\"section table must not be null\"", ")", ";", "Optional", "<", "SectionHeader", ">", "section", "=", "maybeGetSectionTableEntry", "(", "tab...
Calculates the file offset of the data directory based on the virtual address and the entries in the section table. This method is subject to change. @Beta @param table @return file offset of data directory
[ "Calculates", "the", "file", "offset", "of", "the", "data", "directory", "based", "on", "the", "virtual", "address", "and", "the", "entries", "in", "the", "section", "table", ".", "This", "method", "is", "subject", "to", "change", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/optheader/DataDirEntry.java#L126-L135
101,942
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/optheader/DataDirEntry.java
DataDirEntry.getSectionTableEntry
public SectionHeader getSectionTableEntry(SectionTable table) { Optional<SectionHeader> entry = maybeGetSectionTableEntry(table); if (entry.isPresent()) { return entry.get(); } throw new IllegalStateException( "there is no section for this data directory entry...
java
public SectionHeader getSectionTableEntry(SectionTable table) { Optional<SectionHeader> entry = maybeGetSectionTableEntry(table); if (entry.isPresent()) { return entry.get(); } throw new IllegalStateException( "there is no section for this data directory entry...
[ "public", "SectionHeader", "getSectionTableEntry", "(", "SectionTable", "table", ")", "{", "Optional", "<", "SectionHeader", ">", "entry", "=", "maybeGetSectionTableEntry", "(", "table", ")", ";", "if", "(", "entry", ".", "isPresent", "(", ")", ")", "{", "retu...
Returns the section table entry of the section that the data directory entry is pointing to. @param table @return the section table entry of the section that the data directory entry is pointing to @throws IllegalStateException if data dir entry is not in a section
[ "Returns", "the", "section", "table", "entry", "of", "the", "section", "that", "the", "data", "directory", "entry", "is", "pointing", "to", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/optheader/DataDirEntry.java#L147-L154
101,943
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/optheader/DataDirEntry.java
DataDirEntry.maybeGetSectionTableEntry
public Optional<SectionHeader> maybeGetSectionTableEntry(SectionTable table) { checkArgument(table != null, "table must not be null"); List<SectionHeader> sections = table.getSectionHeaders(); // loop through all section headers to check if entry is within section for (SectionHeader head...
java
public Optional<SectionHeader> maybeGetSectionTableEntry(SectionTable table) { checkArgument(table != null, "table must not be null"); List<SectionHeader> sections = table.getSectionHeaders(); // loop through all section headers to check if entry is within section for (SectionHeader head...
[ "public", "Optional", "<", "SectionHeader", ">", "maybeGetSectionTableEntry", "(", "SectionTable", "table", ")", "{", "checkArgument", "(", "table", "!=", "null", ",", "\"table must not be null\"", ")", ";", "List", "<", "SectionHeader", ">", "sections", "=", "tab...
more convenient use of the API
[ "more", "convenient", "use", "of", "the", "API" ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/optheader/DataDirEntry.java#L167-L190
101,944
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java
SectionHeader.getAlignedSizeOfRaw
public long getAlignedSizeOfRaw() { long sizeOfRaw = get(SIZE_OF_RAW_DATA); if (sizeOfRaw == (sizeOfRaw & ~0xfff)) { return sizeOfRaw; } long result = (sizeOfRaw + 0xfff) & ~0xfff; assert result % 4096 == 0; return result; }
java
public long getAlignedSizeOfRaw() { long sizeOfRaw = get(SIZE_OF_RAW_DATA); if (sizeOfRaw == (sizeOfRaw & ~0xfff)) { return sizeOfRaw; } long result = (sizeOfRaw + 0xfff) & ~0xfff; assert result % 4096 == 0; return result; }
[ "public", "long", "getAlignedSizeOfRaw", "(", ")", "{", "long", "sizeOfRaw", "=", "get", "(", "SIZE_OF_RAW_DATA", ")", ";", "if", "(", "sizeOfRaw", "==", "(", "sizeOfRaw", "&", "~", "0xfff", ")", ")", "{", "return", "sizeOfRaw", ";", "}", "long", "result...
Returns the SizeOfRawData rounded up to a multiple of 4kb. @return aligned SizeOfRawData
[ "Returns", "the", "SizeOfRawData", "rounded", "up", "to", "a", "multiple", "of", "4kb", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java#L108-L116
101,945
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java
SectionHeader.getAlignedVirtualSize
public long getAlignedVirtualSize() { long virtSize = get(VIRTUAL_SIZE); if (virtSize == (virtSize & ~0xfff)) { return virtSize; } // TODO: corkami: "a section can have a null VirtualSize: in this case, // only the SizeOfRawData is taken into consideration" lo...
java
public long getAlignedVirtualSize() { long virtSize = get(VIRTUAL_SIZE); if (virtSize == (virtSize & ~0xfff)) { return virtSize; } // TODO: corkami: "a section can have a null VirtualSize: in this case, // only the SizeOfRawData is taken into consideration" lo...
[ "public", "long", "getAlignedVirtualSize", "(", ")", "{", "long", "virtSize", "=", "get", "(", "VIRTUAL_SIZE", ")", ";", "if", "(", "virtSize", "==", "(", "virtSize", "&", "~", "0xfff", ")", ")", "{", "return", "virtSize", ";", "}", "// TODO: corkami: \"a ...
Returns the VirtualSize rounded up to a multiple of 4kb. @return aligned VirtualSize
[ "Returns", "the", "VirtualSize", "rounded", "up", "to", "a", "multiple", "of", "4kb", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java#L123-L133
101,946
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java
SectionHeader.getAlignedVirtualAddress
public long getAlignedVirtualAddress() { long virtAddr = get(VIRTUAL_ADDRESS); if (virtAddr == (virtAddr & ~0xfff)) { return virtAddr; } long result = (virtAddr + 0xfff) & ~0xfff; assert result % 4096 == 0; return result; }
java
public long getAlignedVirtualAddress() { long virtAddr = get(VIRTUAL_ADDRESS); if (virtAddr == (virtAddr & ~0xfff)) { return virtAddr; } long result = (virtAddr + 0xfff) & ~0xfff; assert result % 4096 == 0; return result; }
[ "public", "long", "getAlignedVirtualAddress", "(", ")", "{", "long", "virtAddr", "=", "get", "(", "VIRTUAL_ADDRESS", ")", ";", "if", "(", "virtAddr", "==", "(", "virtAddr", "&", "~", "0xfff", ")", ")", "{", "return", "virtAddr", ";", "}", "long", "result...
Returns the VirtualAddress rounded up to a multiple of 4kb. @return aligned VirtualAddress
[ "Returns", "the", "VirtualAddress", "rounded", "up", "to", "a", "multiple", "of", "4kb", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java#L140-L148
101,947
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java
SectionHeader.getCharacteristics
public List<SectionCharacteristic> getCharacteristics() { long value = get(SectionHeaderKey.CHARACTERISTICS); List<SectionCharacteristic> list = SectionCharacteristic.getAllFor(value); assert list != null; return list; }
java
public List<SectionCharacteristic> getCharacteristics() { long value = get(SectionHeaderKey.CHARACTERISTICS); List<SectionCharacteristic> list = SectionCharacteristic.getAllFor(value); assert list != null; return list; }
[ "public", "List", "<", "SectionCharacteristic", ">", "getCharacteristics", "(", ")", "{", "long", "value", "=", "get", "(", "SectionHeaderKey", ".", "CHARACTERISTICS", ")", ";", "List", "<", "SectionCharacteristic", ">", "list", "=", "SectionCharacteristic", ".", ...
Returns a list of all characteristics of that section. @return list of all characteristics
[ "Returns", "a", "list", "of", "all", "characteristics", "of", "that", "section", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionHeader.java#L211-L216
101,948
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionTable.java
SectionTable.getSectionHeader
public SectionHeader getSectionHeader(int number) { for (SectionHeader header : headers) { if (header.getNumber() == number) { return header; } } throw new IllegalArgumentException( "invalid section number, no section header found"); }
java
public SectionHeader getSectionHeader(int number) { for (SectionHeader header : headers) { if (header.getNumber() == number) { return header; } } throw new IllegalArgumentException( "invalid section number, no section header found"); }
[ "public", "SectionHeader", "getSectionHeader", "(", "int", "number", ")", "{", "for", "(", "SectionHeader", "header", ":", "headers", ")", "{", "if", "(", "header", ".", "getNumber", "(", ")", "==", "number", ")", "{", "return", "header", ";", "}", "}", ...
Returns the section entry that has the given number or null if there is no section with that number. @param number of the section @return the section table entry that has the given number @throw {@link IllegalArgumentException} if no section header for number found
[ "Returns", "the", "section", "entry", "that", "has", "the", "given", "number", "or", "null", "if", "there", "is", "no", "section", "with", "that", "number", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionTable.java#L153-L161
101,949
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionTable.java
SectionTable.getSectionHeader
public SectionHeader getSectionHeader(String sectionName) { for (SectionHeader entry : headers) { if (entry.getName().equals(sectionName)) { return entry; } } throw new IllegalArgumentException( "invalid section name, no section header foun...
java
public SectionHeader getSectionHeader(String sectionName) { for (SectionHeader entry : headers) { if (entry.getName().equals(sectionName)) { return entry; } } throw new IllegalArgumentException( "invalid section name, no section header foun...
[ "public", "SectionHeader", "getSectionHeader", "(", "String", "sectionName", ")", "{", "for", "(", "SectionHeader", "entry", ":", "headers", ")", "{", "if", "(", "entry", ".", "getName", "(", ")", ".", "equals", "(", "sectionName", ")", ")", "{", "return",...
Returns the section entry that has the given name. If there are several sections with the same name, the first one will be returned. @param sectionName name of the section @return the section table entry that has the given sectionName @throw {@link IllegalArgumentException} if no section header for name found
[ "Returns", "the", "section", "entry", "that", "has", "the", "given", "name", ".", "If", "there", "are", "several", "sections", "with", "the", "same", "name", "the", "first", "one", "will", "be", "returned", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionTable.java#L173-L181
101,950
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionTable.java
SectionTable.getSectionHeaderByName
public Optional<SectionHeader> getSectionHeaderByName(String name) { for (SectionHeader header : headers) { if (header.getName().equals(name)) { return Optional.of(header); } } return Optional.absent(); }
java
public Optional<SectionHeader> getSectionHeaderByName(String name) { for (SectionHeader header : headers) { if (header.getName().equals(name)) { return Optional.of(header); } } return Optional.absent(); }
[ "public", "Optional", "<", "SectionHeader", ">", "getSectionHeaderByName", "(", "String", "name", ")", "{", "for", "(", "SectionHeader", "header", ":", "headers", ")", "{", "if", "(", "header", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", "...
Returns an optional of the first section that has the given name. @param name @return first section with the given name, absent if no section with that name found
[ "Returns", "an", "optional", "of", "the", "first", "section", "that", "has", "the", "given", "name", "." ]
319f08560aa58e3d5d7abe346ffdf623d6dc6990
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionTable.java#L231-L238
101,951
robinst/autolink-java
src/main/java/org/nibor/autolink/Autolink.java
Autolink.renderLinks
@Deprecated public static String renderLinks(CharSequence input, Iterable<LinkSpan> links, LinkRenderer linkRenderer) { if (input == null) { throw new NullPointerException("input must not be null"); } if (links == null) { throw new NullPointerException("links must not...
java
@Deprecated public static String renderLinks(CharSequence input, Iterable<LinkSpan> links, LinkRenderer linkRenderer) { if (input == null) { throw new NullPointerException("input must not be null"); } if (links == null) { throw new NullPointerException("links must not...
[ "@", "Deprecated", "public", "static", "String", "renderLinks", "(", "CharSequence", "input", ",", "Iterable", "<", "LinkSpan", ">", "links", ",", "LinkRenderer", "linkRenderer", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPoin...
Render the supplied links from the supplied input text using a renderer. The parts of the text outside of links are added to the result without processing. @param input the input text, must not be null @param links the links to render, see {@link LinkExtractor} to extract them @param linkRenderer the link rendering im...
[ "Render", "the", "supplied", "links", "from", "the", "supplied", "input", "text", "using", "a", "renderer", ".", "The", "parts", "of", "the", "text", "outside", "of", "links", "are", "added", "to", "the", "result", "without", "processing", "." ]
9b01c2620d450cd51942f4d092e4e7153980c6d8
https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/Autolink.java#L18-L40
101,952
robinst/autolink-java
src/main/java/org/nibor/autolink/internal/EmailScanner.java
EmailScanner.findFirst
private int findFirst(CharSequence input, int beginIndex, int rewindIndex) { int first = -1; boolean atomBoundary = true; for (int i = beginIndex; i >= rewindIndex; i--) { char c = input.charAt(i); if (localAtomAllowed(c)) { first = i; atom...
java
private int findFirst(CharSequence input, int beginIndex, int rewindIndex) { int first = -1; boolean atomBoundary = true; for (int i = beginIndex; i >= rewindIndex; i--) { char c = input.charAt(i); if (localAtomAllowed(c)) { first = i; atom...
[ "private", "int", "findFirst", "(", "CharSequence", "input", ",", "int", "beginIndex", ",", "int", "rewindIndex", ")", "{", "int", "first", "=", "-", "1", ";", "boolean", "atomBoundary", "=", "true", ";", "for", "(", "int", "i", "=", "beginIndex", ";", ...
See "Local-part" in RFC 5321, plus extensions in RFC 6531
[ "See", "Local", "-", "part", "in", "RFC", "5321", "plus", "extensions", "in", "RFC", "6531" ]
9b01c2620d450cd51942f4d092e4e7153980c6d8
https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/internal/EmailScanner.java#L37-L55
101,953
robinst/autolink-java
src/main/java/org/nibor/autolink/internal/EmailScanner.java
EmailScanner.findLast
private int findLast(CharSequence input, int beginIndex) { boolean firstInSubDomain = true; boolean canEndSubDomain = false; int firstDot = -1; int last = -1; for (int i = beginIndex; i < input.length(); i++) { char c = input.charAt(i); if (firstInSubDomai...
java
private int findLast(CharSequence input, int beginIndex) { boolean firstInSubDomain = true; boolean canEndSubDomain = false; int firstDot = -1; int last = -1; for (int i = beginIndex; i < input.length(); i++) { char c = input.charAt(i); if (firstInSubDomai...
[ "private", "int", "findLast", "(", "CharSequence", "input", ",", "int", "beginIndex", ")", "{", "boolean", "firstInSubDomain", "=", "true", ";", "boolean", "canEndSubDomain", "=", "false", ";", "int", "firstDot", "=", "-", "1", ";", "int", "last", "=", "-"...
See "Domain" in RFC 5321, plus extension of "sub-domain" in RFC 6531
[ "See", "Domain", "in", "RFC", "5321", "plus", "extension", "of", "sub", "-", "domain", "in", "RFC", "6531" ]
9b01c2620d450cd51942f4d092e4e7153980c6d8
https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/internal/EmailScanner.java#L58-L97
101,954
robinst/autolink-java
src/main/java/org/nibor/autolink/internal/EmailScanner.java
EmailScanner.localAtomAllowed
private boolean localAtomAllowed(char c) { if (Scanners.isAlnum(c) || Scanners.isNonAscii(c)) { return true; } switch (c) { case '!': case '#': case '$': case '%': case '&': case '\'': case '*': ...
java
private boolean localAtomAllowed(char c) { if (Scanners.isAlnum(c) || Scanners.isNonAscii(c)) { return true; } switch (c) { case '!': case '#': case '$': case '%': case '&': case '\'': case '*': ...
[ "private", "boolean", "localAtomAllowed", "(", "char", "c", ")", "{", "if", "(", "Scanners", ".", "isAlnum", "(", "c", ")", "||", "Scanners", ".", "isNonAscii", "(", "c", ")", ")", "{", "return", "true", ";", "}", "switch", "(", "c", ")", "{", "cas...
See "Atom" in RFC 5321, "atext" in RFC 5322
[ "See", "Atom", "in", "RFC", "5321", "atext", "in", "RFC", "5322" ]
9b01c2620d450cd51942f4d092e4e7153980c6d8
https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/internal/EmailScanner.java#L100-L127
101,955
robinst/autolink-java
src/main/java/org/nibor/autolink/internal/UrlScanner.java
UrlScanner.findFirst
private int findFirst(CharSequence input, int beginIndex, int rewindIndex) { int first = -1; int digit = -1; for (int i = beginIndex; i >= rewindIndex; i--) { char c = input.charAt(i); if (Scanners.isAlpha(c)) { first = i; } else if (Scanners.i...
java
private int findFirst(CharSequence input, int beginIndex, int rewindIndex) { int first = -1; int digit = -1; for (int i = beginIndex; i >= rewindIndex; i--) { char c = input.charAt(i); if (Scanners.isAlpha(c)) { first = i; } else if (Scanners.i...
[ "private", "int", "findFirst", "(", "CharSequence", "input", ",", "int", "beginIndex", ",", "int", "rewindIndex", ")", "{", "int", "first", "=", "-", "1", ";", "int", "digit", "=", "-", "1", ";", "for", "(", "int", "i", "=", "beginIndex", ";", "i", ...
See "scheme" in RFC 3986
[ "See", "scheme", "in", "RFC", "3986" ]
9b01c2620d450cd51942f4d092e4e7153980c6d8
https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/internal/UrlScanner.java#L35-L54
101,956
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/AsmUtils.java
AsmUtils.readAndPatchClass
@SuppressForbidden @SuppressWarnings("unused") public static ClassReader readAndPatchClass(InputStream in) throws IOException { final byte[] bytecode = readStream(in); if (false) patchClassMajorVersion(bytecode, Opcodes.V10 + 1, Opcodes.V10); return new ClassReader(bytecode); }
java
@SuppressForbidden @SuppressWarnings("unused") public static ClassReader readAndPatchClass(InputStream in) throws IOException { final byte[] bytecode = readStream(in); if (false) patchClassMajorVersion(bytecode, Opcodes.V10 + 1, Opcodes.V10); return new ClassReader(bytecode); }
[ "@", "SuppressForbidden", "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "ClassReader", "readAndPatchClass", "(", "InputStream", "in", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "bytecode", "=", "readStream", "(", "in", "...
Utility method to load class files of later Java versions by patching them, so ASM can read them. Does nothing at the moment.
[ "Utility", "method", "to", "load", "class", "files", "of", "later", "Java", "versions", "by", "patching", "them", "so", "ASM", "can", "read", "them", ".", "Does", "nothing", "at", "the", "moment", "." ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/AsmUtils.java#L178-L184
101,957
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/maven/SignaturesArtifact.java
SignaturesArtifact.createArtifact
Artifact createArtifact(ArtifactFactory artifactFactory) { if (groupId == null || artifactId == null || version == null || type == null) { throw new NullPointerException("signaturesArtifact is missing some properties. Required are: groupId, artifactId, version, type"); } return artifactFactory.createA...
java
Artifact createArtifact(ArtifactFactory artifactFactory) { if (groupId == null || artifactId == null || version == null || type == null) { throw new NullPointerException("signaturesArtifact is missing some properties. Required are: groupId, artifactId, version, type"); } return artifactFactory.createA...
[ "Artifact", "createArtifact", "(", "ArtifactFactory", "artifactFactory", ")", "{", "if", "(", "groupId", "==", "null", "||", "artifactId", "==", "null", "||", "version", "==", "null", "||", "type", "==", "null", ")", "{", "throw", "new", "NullPointerException"...
Used by the mojo to fetch the artifact
[ "Used", "by", "the", "mojo", "to", "fetch", "the", "artifact" ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/maven/SignaturesArtifact.java#L54-L59
101,958
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/Checker.java
Checker.loadClassFromJigsaw
private ClassSignature loadClassFromJigsaw(String classname) throws IOException { if (method_Class_getModule == null || method_Module_getName == null) { return null; // not Jigsaw Module System } final Class<?> clazz; final String moduleName; try { clazz = Class.forName(classname, f...
java
private ClassSignature loadClassFromJigsaw(String classname) throws IOException { if (method_Class_getModule == null || method_Module_getName == null) { return null; // not Jigsaw Module System } final Class<?> clazz; final String moduleName; try { clazz = Class.forName(classname, f...
[ "private", "ClassSignature", "loadClassFromJigsaw", "(", "String", "classname", ")", "throws", "IOException", "{", "if", "(", "method_Class_getModule", "==", "null", "||", "method_Module_getName", "==", "null", ")", "{", "return", "null", ";", "// not Jigsaw Module Sy...
Loads the class from Java9's module system and uses reflection to get methods and fields.
[ "Loads", "the", "class", "from", "Java9", "s", "module", "system", "and", "uses", "reflection", "to", "get", "methods", "and", "fields", "." ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/Checker.java#L187-L203
101,959
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/Checker.java
Checker.parseSignaturesFile
public void parseSignaturesFile(URL url) throws IOException,ParseException { parseSignaturesFile(url.openStream(), url.toString()); }
java
public void parseSignaturesFile(URL url) throws IOException,ParseException { parseSignaturesFile(url.openStream(), url.toString()); }
[ "public", "void", "parseSignaturesFile", "(", "URL", "url", ")", "throws", "IOException", ",", "ParseException", "{", "parseSignaturesFile", "(", "url", ".", "openStream", "(", ")", ",", "url", ".", "toString", "(", ")", ")", ";", "}" ]
Reads a list of API signatures from the given URL.
[ "Reads", "a", "list", "of", "API", "signatures", "from", "the", "given", "URL", "." ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/Checker.java#L329-L331
101,960
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/Checker.java
Checker.parseSignaturesFile
public void parseSignaturesFile(File f) throws IOException,ParseException { parseSignaturesFile(new FileInputStream(f), f.toString()); }
java
public void parseSignaturesFile(File f) throws IOException,ParseException { parseSignaturesFile(new FileInputStream(f), f.toString()); }
[ "public", "void", "parseSignaturesFile", "(", "File", "f", ")", "throws", "IOException", ",", "ParseException", "{", "parseSignaturesFile", "(", "new", "FileInputStream", "(", "f", ")", ",", "f", ".", "toString", "(", ")", ")", ";", "}" ]
Reads a list of API signatures from the given file.
[ "Reads", "a", "list", "of", "API", "signatures", "from", "the", "given", "file", "." ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/Checker.java#L334-L336
101,961
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/Checker.java
Checker.checkClass
private int checkClass(final ClassReader reader, Pattern suppressAnnotationsPattern) throws ForbiddenApiException { final String className = Type.getObjectType(reader.getClassName()).getClassName(); final ClassScanner scanner = new ClassScanner(this, forbiddenSignatures, suppressAnnotationsPattern); try { ...
java
private int checkClass(final ClassReader reader, Pattern suppressAnnotationsPattern) throws ForbiddenApiException { final String className = Type.getObjectType(reader.getClassName()).getClassName(); final ClassScanner scanner = new ClassScanner(this, forbiddenSignatures, suppressAnnotationsPattern); try { ...
[ "private", "int", "checkClass", "(", "final", "ClassReader", "reader", ",", "Pattern", "suppressAnnotationsPattern", ")", "throws", "ForbiddenApiException", "{", "final", "String", "className", "=", "Type", ".", "getObjectType", "(", "reader", ".", "getClassName", "...
Parses a class and checks for valid method invocations
[ "Parses", "a", "class", "and", "checks", "for", "valid", "method", "invocations" ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/Checker.java#L406-L434
101,962
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/Signatures.java
Signatures.parseSignaturesString
public void parseSignaturesString(String signatures) throws IOException,ParseException { logger.info("Reading inline API signatures..."); final Set<String> missingClasses = new TreeSet<String>(); parseSignaturesFile(new StringReader(signatures), false, missingClasses); reportMissingSignatureClasses(miss...
java
public void parseSignaturesString(String signatures) throws IOException,ParseException { logger.info("Reading inline API signatures..."); final Set<String> missingClasses = new TreeSet<String>(); parseSignaturesFile(new StringReader(signatures), false, missingClasses); reportMissingSignatureClasses(miss...
[ "public", "void", "parseSignaturesString", "(", "String", "signatures", ")", "throws", "IOException", ",", "ParseException", "{", "logger", ".", "info", "(", "\"Reading inline API signatures...\"", ")", ";", "final", "Set", "<", "String", ">", "missingClasses", "=",...
Reads a list of API signatures from a String.
[ "Reads", "a", "list", "of", "API", "signatures", "from", "a", "String", "." ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/Signatures.java#L309-L314
101,963
policeman-tools/forbidden-apis
src/main/java/de/thetaphi/forbiddenapis/ant/AntTask.java
AntTask.createBundledSignatures
public BundledSignaturesType createBundledSignatures() { final BundledSignaturesType s = new BundledSignaturesType(); s.setProject(getProject()); bundledSignatures.add(s); return s; }
java
public BundledSignaturesType createBundledSignatures() { final BundledSignaturesType s = new BundledSignaturesType(); s.setProject(getProject()); bundledSignatures.add(s); return s; }
[ "public", "BundledSignaturesType", "createBundledSignatures", "(", ")", "{", "final", "BundledSignaturesType", "s", "=", "new", "BundledSignaturesType", "(", ")", ";", "s", ".", "setProject", "(", "getProject", "(", ")", ")", ";", "bundledSignatures", ".", "add", ...
Creates a bundled signatures instance
[ "Creates", "a", "bundled", "signatures", "instance" ]
df5f00c6bb779875ec6bae967f7cec96670b27d9
https://github.com/policeman-tools/forbidden-apis/blob/df5f00c6bb779875ec6bae967f7cec96670b27d9/src/main/java/de/thetaphi/forbiddenapis/ant/AntTask.java#L269-L274
101,964
FasterXML/woodstox
src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java
WstxBundleActivator.start
@Override public void start(BundleContext ctxt) { InputFactoryProviderImpl inputP = new InputFactoryProviderImpl(); ctxt.registerService(Stax2InputFactoryProvider.class.getName(), inputP, inputP.getProperties()); OutputFactoryProviderImpl outputP = new OutputFactoryProviderImpl(); ...
java
@Override public void start(BundleContext ctxt) { InputFactoryProviderImpl inputP = new InputFactoryProviderImpl(); ctxt.registerService(Stax2InputFactoryProvider.class.getName(), inputP, inputP.getProperties()); OutputFactoryProviderImpl outputP = new OutputFactoryProviderImpl(); ...
[ "@", "Override", "public", "void", "start", "(", "BundleContext", "ctxt", ")", "{", "InputFactoryProviderImpl", "inputP", "=", "new", "InputFactoryProviderImpl", "(", ")", ";", "ctxt", ".", "registerService", "(", "Stax2InputFactoryProvider", ".", "class", ".", "g...
Method called on activation. We need to register all providers we have at this point.
[ "Method", "called", "on", "activation", ".", "We", "need", "to", "register", "all", "providers", "we", "have", "at", "this", "point", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java#L26-L38
101,965
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/InputElementStack.java
InputElementStack.createNonTransientNsContext
public BaseNsContext createNonTransientNsContext(Location loc) { // Have an instance we can reuse? Great! if (mLastNsContext != null) { return mLastNsContext; } // No namespaces declared at this point? Easy, as well: int totalNsSize = mNamespaces.size(); ...
java
public BaseNsContext createNonTransientNsContext(Location loc) { // Have an instance we can reuse? Great! if (mLastNsContext != null) { return mLastNsContext; } // No namespaces declared at this point? Easy, as well: int totalNsSize = mNamespaces.size(); ...
[ "public", "BaseNsContext", "createNonTransientNsContext", "(", "Location", "loc", ")", "{", "// Have an instance we can reuse? Great!", "if", "(", "mLastNsContext", "!=", "null", ")", "{", "return", "mLastNsContext", ";", "}", "// No namespaces declared at this point? Easy, a...
Method called to construct a non-transient NamespaceContext instance; generally needed when creating events to return from event-based iterators.
[ "Method", "called", "to", "construct", "a", "non", "-", "transient", "NamespaceContext", "instance", ";", "generally", "needed", "when", "creating", "events", "to", "return", "from", "event", "-", "based", "iterators", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/InputElementStack.java#L289-L316
101,966
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/InputElementStack.java
InputElementStack.addDefaultAttribute
@Override public int addDefaultAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException { return mAttrCollector.addDefaultAttribute(localName, uri, prefix, value); }
java
@Override public int addDefaultAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException { return mAttrCollector.addDefaultAttribute(localName, uri, prefix, value); }
[ "@", "Override", "public", "int", "addDefaultAttribute", "(", "String", "localName", ",", "String", "uri", ",", "String", "prefix", ",", "String", "value", ")", "throws", "XMLStreamException", "{", "return", "mAttrCollector", ".", "addDefaultAttribute", "(", "loca...
Method called by actual validator instances when attributes with default values have no explicit values for the element; if so, default value needs to be added as if it was parsed from the element.
[ "Method", "called", "by", "actual", "validator", "instances", "when", "attributes", "with", "default", "values", "have", "no", "explicit", "values", "for", "the", "element", ";", "if", "so", "default", "value", "needs", "to", "be", "added", "as", "if", "it",...
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/InputElementStack.java#L858-L863
101,967
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/ChoiceModel.java
ChoiceModel.cloneModel
@Override public ModelNode cloneModel() { int len = mSubModels.length; ModelNode[] newModels = new ModelNode[len]; for (int i = 0; i < len; ++i) { newModels[i] = mSubModels[i].cloneModel(); } return new ChoiceModel(newModels); }
java
@Override public ModelNode cloneModel() { int len = mSubModels.length; ModelNode[] newModels = new ModelNode[len]; for (int i = 0; i < len; ++i) { newModels[i] = mSubModels[i].cloneModel(); } return new ChoiceModel(newModels); }
[ "@", "Override", "public", "ModelNode", "cloneModel", "(", ")", "{", "int", "len", "=", "mSubModels", ".", "length", ";", "ModelNode", "[", "]", "newModels", "=", "new", "ModelNode", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", ...
Method that has to create a deep copy of the model, without sharing any of existing Objects.
[ "Method", "that", "has", "to", "create", "a", "deep", "copy", "of", "the", "model", "without", "sharing", "any", "of", "existing", "Objects", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/ChoiceModel.java#L62-L71
101,968
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/RepairingNsStreamWriter.java
RepairingNsStreamWriter.findOrCreateAttrPrefix
protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI, SimpleOutputElement elem) throws XMLStreamException { if (nsURI == null || nsURI.length() == 0) { /* Attributes never use the default namespace; missing ...
java
protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI, SimpleOutputElement elem) throws XMLStreamException { if (nsURI == null || nsURI.length() == 0) { /* Attributes never use the default namespace; missing ...
[ "protected", "final", "String", "findOrCreateAttrPrefix", "(", "String", "suggPrefix", ",", "String", "nsURI", ",", "SimpleOutputElement", "elem", ")", "throws", "XMLStreamException", "{", "if", "(", "nsURI", "==", "null", "||", "nsURI", ".", "length", "(", ")",...
Method called to somehow find a prefix for given namespace, to be used for a new start element; either use an existing one, or generate a new one. If a new mapping needs to be generated, it will also be automatically bound, and necessary namespace declaration output. @param suggPrefix Suggested prefix to bind, if any;...
[ "Method", "called", "to", "somehow", "find", "a", "prefix", "for", "given", "namespace", "to", "be", "used", "for", "a", "new", "start", "element", ";", "either", "use", "an", "existing", "one", "or", "generate", "a", "new", "one", ".", "If", "a", "new...
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/RepairingNsStreamWriter.java#L553-L626
101,969
FasterXML/woodstox
src/main/java/com/ctc/wstx/stax/WstxInputFactory.java
WstxInputFactory.createXMLStreamReader
@Override public XMLStreamReader2 createXMLStreamReader(File f) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the File */ return createSR(f, false, true); }
java
@Override public XMLStreamReader2 createXMLStreamReader(File f) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the File */ return createSR(f, false, true); }
[ "@", "Override", "public", "XMLStreamReader2", "createXMLStreamReader", "(", "File", "f", ")", "throws", "XMLStreamException", "{", "/* true for auto-close, since caller has no access to the underlying\n * input stream created from the File\n */", "return", "createSR", ...
Convenience factory method that allows for parsing a document stored in the specified file.
[ "Convenience", "factory", "method", "that", "allows", "for", "parsing", "a", "document", "stored", "in", "the", "specified", "file", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxInputFactory.java#L491-L499
101,970
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDSubsetImpl.java
DTDSubsetImpl.combineWithExternalSubset
@Override public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws XMLStreamException { /* First let's see if we can just reuse GE Map used by int or ext * subset; (if only one has contents), or if not, combine them. */ HashMap<St...
java
@Override public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws XMLStreamException { /* First let's see if we can just reuse GE Map used by int or ext * subset; (if only one has contents), or if not, combine them. */ HashMap<St...
[ "@", "Override", "public", "DTDSubset", "combineWithExternalSubset", "(", "InputProblemReporter", "rep", ",", "DTDSubset", "extSubset", ")", "throws", "XMLStreamException", "{", "/* First let's see if we can just reuse GE Map used by int or ext\n * subset; (if only one has cont...
Method that will combine definitions from internal and external subsets, producing a single DTD set.
[ "Method", "that", "will", "combine", "definitions", "from", "internal", "and", "external", "subsets", "producing", "a", "single", "DTD", "set", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDSubsetImpl.java#L198-L260
101,971
FasterXML/woodstox
src/main/java/com/ctc/wstx/sax/WstxSAXParser.java
WstxSAXParser.dtdNotationDecl
@Override public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL) throws XMLStreamException { if (mDTDHandler != null) { /* 24-Nov-2006, TSa: Note: SAX expects system identifiers to * be fully resolved when reported... */ ...
java
@Override public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL) throws XMLStreamException { if (mDTDHandler != null) { /* 24-Nov-2006, TSa: Note: SAX expects system identifiers to * be fully resolved when reported... */ ...
[ "@", "Override", "public", "void", "dtdNotationDecl", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ",", "URL", "baseURL", ")", "throws", "XMLStreamException", "{", "if", "(", "mDTDHandler", "!=", "null", ")", "{", "/* 24-Nov-200...
DTD declarations that must be exposed
[ "DTD", "declarations", "that", "must", "be", "exposed" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sax/WstxSAXParser.java#L1181-L1202
101,972
FasterXML/woodstox
src/main/java/com/ctc/wstx/sax/WstxSAXParser.java
WstxSAXParser.attributeDecl
@Override public void attributeDecl(String eName, String aName, String type, String mode, String value) { if (mDeclHandler != null) { try { mDeclHandler.attributeDecl(eName, aName, type, mode, value); } catch (SAXException sex) { throw new WrappedS...
java
@Override public void attributeDecl(String eName, String aName, String type, String mode, String value) { if (mDeclHandler != null) { try { mDeclHandler.attributeDecl(eName, aName, type, mode, value); } catch (SAXException sex) { throw new WrappedS...
[ "@", "Override", "public", "void", "attributeDecl", "(", "String", "eName", ",", "String", "aName", ",", "String", "type", ",", "String", "mode", ",", "String", "value", ")", "{", "if", "(", "mDeclHandler", "!=", "null", ")", "{", "try", "{", "mDeclHandl...
DTD declarations that can be exposed
[ "DTD", "declarations", "that", "can", "be", "exposed" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sax/WstxSAXParser.java#L1227-L1237
101,973
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDElement.java
DTDElement.createDefined
public static DTDElement createDefined(ReaderConfig cfg, Location loc, PrefixedName name, StructValidator val, int allowedContent) { if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check ExceptionUtil.throwInternal("trying to use...
java
public static DTDElement createDefined(ReaderConfig cfg, Location loc, PrefixedName name, StructValidator val, int allowedContent) { if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check ExceptionUtil.throwInternal("trying to use...
[ "public", "static", "DTDElement", "createDefined", "(", "ReaderConfig", "cfg", ",", "Location", "loc", ",", "PrefixedName", "name", ",", "StructValidator", "val", ",", "int", "allowedContent", ")", "{", "if", "(", "allowedContent", "==", "XMLValidator", ".", "CO...
Method called to create an actual element definition, matching an ELEMENT directive in a DTD subset.
[ "Method", "called", "to", "create", "an", "actual", "element", "definition", "matching", "an", "ELEMENT", "directive", "in", "a", "DTD", "subset", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L158-L166
101,974
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDElement.java
DTDElement.createPlaceholder
public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name) { return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED, cfg.willSupportNamespaces(), cfg.isXml11()); }
java
public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name) { return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED, cfg.willSupportNamespaces(), cfg.isXml11()); }
[ "public", "static", "DTDElement", "createPlaceholder", "(", "ReaderConfig", "cfg", ",", "Location", "loc", ",", "PrefixedName", "name", ")", "{", "return", "new", "DTDElement", "(", "loc", ",", "name", ",", "null", ",", "XMLValidator", ".", "CONTENT_ALLOW_UNDEFI...
Method called to create a "placeholder" element definition, needed to contain attribute definitions.
[ "Method", "called", "to", "create", "a", "placeholder", "element", "definition", "needed", "to", "contain", "attribute", "definitions", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L172-L176
101,975
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDElement.java
DTDElement.defineFrom
public void defineFrom(InputProblemReporter rep, DTDElement definedElem, boolean fullyValidate) throws XMLStreamException { if (fullyValidate) { verifyUndefined(); } mValidator = definedElem.mValidator; mAllowedContent = definedElem.mAll...
java
public void defineFrom(InputProblemReporter rep, DTDElement definedElem, boolean fullyValidate) throws XMLStreamException { if (fullyValidate) { verifyUndefined(); } mValidator = definedElem.mValidator; mAllowedContent = definedElem.mAll...
[ "public", "void", "defineFrom", "(", "InputProblemReporter", "rep", ",", "DTDElement", "definedElem", ",", "boolean", "fullyValidate", ")", "throws", "XMLStreamException", "{", "if", "(", "fullyValidate", ")", "{", "verifyUndefined", "(", ")", ";", "}", "mValidato...
Method called to "upgrade" a placeholder using a defined element, including adding attributes.
[ "Method", "called", "to", "upgrade", "a", "placeholder", "using", "a", "defined", "element", "including", "adding", "attributes", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L211-L221
101,976
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDElement.java
DTDElement.addAttribute
public DTDAttribute addAttribute(InputProblemReporter rep, PrefixedName attrName, int valueType, DefaultAttrValue defValue, WordResolver enumValues, boolean fullyValidate) throws XMLStreamException ...
java
public DTDAttribute addAttribute(InputProblemReporter rep, PrefixedName attrName, int valueType, DefaultAttrValue defValue, WordResolver enumValues, boolean fullyValidate) throws XMLStreamException ...
[ "public", "DTDAttribute", "addAttribute", "(", "InputProblemReporter", "rep", ",", "PrefixedName", "attrName", ",", "int", "valueType", ",", "DefaultAttrValue", "defValue", ",", "WordResolver", "enumValues", ",", "boolean", "fullyValidate", ")", "throws", "XMLStreamExce...
Method called by DTD parser when it has read information about an attribute that belong to this element @return Newly created attribute Object if the attribute definition was added (hadn't been declared yet); null if it's a duplicate, in which case original definition sticks.
[ "Method", "called", "by", "DTD", "parser", "when", "it", "has", "read", "information", "about", "an", "attribute", "that", "belong", "to", "this", "element" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L238-L308
101,977
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDElement.java
DTDElement.addNsDefault
public DTDAttribute addNsDefault (InputProblemReporter rep, PrefixedName attrName, int valueType, DefaultAttrValue defValue, boolean fullyValidate) throws XMLStreamException { /* Let's simplify handling a bit: although theoretically all * combinations of value can be used, ...
java
public DTDAttribute addNsDefault (InputProblemReporter rep, PrefixedName attrName, int valueType, DefaultAttrValue defValue, boolean fullyValidate) throws XMLStreamException { /* Let's simplify handling a bit: although theoretically all * combinations of value can be used, ...
[ "public", "DTDAttribute", "addNsDefault", "(", "InputProblemReporter", "rep", ",", "PrefixedName", "attrName", ",", "int", "valueType", ",", "DefaultAttrValue", "defValue", ",", "boolean", "fullyValidate", ")", "throws", "XMLStreamException", "{", "/* Let's simplify handl...
Method called to add a definition of a namespace-declaration pseudo-attribute with a default value. @param rep Reporter to use to report non-fatal problems @param fullyValidate Whether this is being invoked for actual DTD validation, or just the "typing non-validator" @return Attribute that acts as the placeholder, i...
[ "Method", "called", "to", "add", "a", "definition", "of", "a", "namespace", "-", "declaration", "pseudo", "-", "attribute", "with", "a", "default", "value", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDElement.java#L322-L359
101,978
FasterXML/woodstox
src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java
WstxOutputFactory.createSW
@SuppressWarnings("resource") private XMLStreamWriter2 createSW(OutputStream out, Writer w, String enc, boolean requireAutoClose) throws XMLStreamException { /* Need to ensure that the configuration object is not shared * any more; otherwise later c...
java
@SuppressWarnings("resource") private XMLStreamWriter2 createSW(OutputStream out, Writer w, String enc, boolean requireAutoClose) throws XMLStreamException { /* Need to ensure that the configuration object is not shared * any more; otherwise later c...
[ "@", "SuppressWarnings", "(", "\"resource\"", ")", "private", "XMLStreamWriter2", "createSW", "(", "OutputStream", "out", ",", "Writer", "w", ",", "String", "enc", ",", "boolean", "requireAutoClose", ")", "throws", "XMLStreamException", "{", "/* Need to ensure that th...
Bottleneck factory method used internally; needs to take care of passing proper settings to stream writer. @param requireAutoClose Whether this result will always require auto-close be enabled (true); or only if application has requested it (false)
[ "Bottleneck", "factory", "method", "used", "internally", ";", "needs", "to", "take", "care", "of", "passing", "proper", "settings", "to", "stream", "writer", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxOutputFactory.java#L247-L303
101,979
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/OutputElementBase.java
OutputElementBase.isPrefixValid
public final int isPrefixValid(String prefix, String nsURI, boolean isElement) throws XMLStreamException { // Hmmm.... caller shouldn't really pass null. if (nsURI == null) { nsURI = ""; } /* First thing is to see if specified p...
java
public final int isPrefixValid(String prefix, String nsURI, boolean isElement) throws XMLStreamException { // Hmmm.... caller shouldn't really pass null. if (nsURI == null) { nsURI = ""; } /* First thing is to see if specified p...
[ "public", "final", "int", "isPrefixValid", "(", "String", "prefix", ",", "String", "nsURI", ",", "boolean", "isElement", ")", "throws", "XMLStreamException", "{", "// Hmmm.... caller shouldn't really pass null.", "if", "(", "nsURI", "==", "null", ")", "{", "nsURI", ...
Method that verifies that passed-in prefix indeed maps to the specified namespace URI; and depending on how it goes returns a status for caller. @param isElement If true, rules for the default NS are those of elements (ie. empty prefix can map to non-default namespace); if false, rules are those of attributes (only no...
[ "Method", "that", "verifies", "that", "passed", "-", "in", "prefix", "indeed", "maps", "to", "the", "specified", "namespace", "URI", ";", "and", "depending", "on", "how", "it", "goes", "returns", "a", "status", "for", "caller", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/OutputElementBase.java#L182-L247
101,980
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java
BaseNsStreamWriter.writeAttribute
@Override public void writeAttribute(String localName, String value) throws XMLStreamException { // No need to set mAnyOutput, nor close the element if (!mStartElementOpen && mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); } doWriteAttr(l...
java
@Override public void writeAttribute(String localName, String value) throws XMLStreamException { // No need to set mAnyOutput, nor close the element if (!mStartElementOpen && mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); } doWriteAttr(l...
[ "@", "Override", "public", "void", "writeAttribute", "(", "String", "localName", ",", "String", "value", ")", "throws", "XMLStreamException", "{", "// No need to set mAnyOutput, nor close the element", "if", "(", "!", "mStartElementOpen", "&&", "mCheckStructure", ")", "...
It's assumed calling this method implies caller just wants to add an attribute that does not belong to any namespace; as such no namespace checking or prefix generation is needed.
[ "It", "s", "assumed", "calling", "this", "method", "implies", "caller", "just", "wants", "to", "add", "an", "attribute", "that", "does", "not", "belong", "to", "any", "namespace", ";", "as", "such", "no", "namespace", "checking", "or", "prefix", "generation"...
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java#L219-L228
101,981
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java
EncodingXmlWriter.writeTypedElement
@Override public final void writeTypedElement(AsciiValueEncoder enc) throws IOException { if (mSurrogate != 0) { throwUnpairedSurrogate(); } if (enc.bufferNeedsFlush(mOutputBuffer.length - mOutputPtr)) { flush(); } while (true) { ...
java
@Override public final void writeTypedElement(AsciiValueEncoder enc) throws IOException { if (mSurrogate != 0) { throwUnpairedSurrogate(); } if (enc.bufferNeedsFlush(mOutputBuffer.length - mOutputPtr)) { flush(); } while (true) { ...
[ "@", "Override", "public", "final", "void", "writeTypedElement", "(", "AsciiValueEncoder", "enc", ")", "throws", "IOException", "{", "if", "(", "mSurrogate", "!=", "0", ")", "{", "throwUnpairedSurrogate", "(", ")", ";", "}", "if", "(", "enc", ".", "bufferNee...
Non-validating version of typed write method
[ "Non", "-", "validating", "version", "of", "typed", "write", "method" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java#L578-L596
101,982
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java
EncodingXmlWriter.writeTypedElement
@Override public final void writeTypedElement(AsciiValueEncoder enc, XMLValidator validator, char[] copyBuffer) throws IOException, XMLStreamException { if (mSurrogate != 0) { throwUnpairedSurrogate(); } /* Ok, this gets trickier: can't use efficient dire...
java
@Override public final void writeTypedElement(AsciiValueEncoder enc, XMLValidator validator, char[] copyBuffer) throws IOException, XMLStreamException { if (mSurrogate != 0) { throwUnpairedSurrogate(); } /* Ok, this gets trickier: can't use efficient dire...
[ "@", "Override", "public", "final", "void", "writeTypedElement", "(", "AsciiValueEncoder", "enc", ",", "XMLValidator", "validator", ",", "char", "[", "]", "copyBuffer", ")", "throws", "IOException", ",", "XMLStreamException", "{", "if", "(", "mSurrogate", "!=", ...
Validating version of typed write method
[ "Validating", "version", "of", "typed", "write", "method" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java#L601-L624
101,983
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java
EncodingXmlWriter.writeAsEntity
protected final int writeAsEntity(int c) throws IOException { byte[] buf = mOutputBuffer; int ptr = mOutputPtr; if ((ptr + 10) >= buf.length) { // &#x [up to 6 hex digits] ; flushBuffer(); ptr = mOutputPtr; } buf[ptr++] = BYTE_AMP; // ...
java
protected final int writeAsEntity(int c) throws IOException { byte[] buf = mOutputBuffer; int ptr = mOutputPtr; if ((ptr + 10) >= buf.length) { // &#x [up to 6 hex digits] ; flushBuffer(); ptr = mOutputPtr; } buf[ptr++] = BYTE_AMP; // ...
[ "protected", "final", "int", "writeAsEntity", "(", "int", "c", ")", "throws", "IOException", "{", "byte", "[", "]", "buf", "=", "mOutputBuffer", ";", "int", "ptr", "=", "mOutputPtr", ";", "if", "(", "(", "ptr", "+", "10", ")", ">=", "buf", ".", "leng...
Entity writing can be optimized quite nicely, since it only needs to output ascii characters. @return New value of <code>mOutputPtr</code>
[ "Entity", "writing", "can", "be", "optimized", "quite", "nicely", "since", "it", "only", "needs", "to", "output", "ascii", "characters", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/EncodingXmlWriter.java#L828-L896
101,984
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/DataUtil.java
DataUtil.anyValuesInCommon
public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2) { // Let's always iterate over smaller collection: if (c1.size() > c2.size()) { Collection<T> tmp = c1; c1 = c2; c2 = tmp; } Iterator<T> it = c1.iterator(); whi...
java
public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2) { // Let's always iterate over smaller collection: if (c1.size() > c2.size()) { Collection<T> tmp = c1; c1 = c2; c2 = tmp; } Iterator<T> it = c1.iterator(); whi...
[ "public", "static", "<", "T", ">", "boolean", "anyValuesInCommon", "(", "Collection", "<", "T", ">", "c1", ",", "Collection", "<", "T", ">", "c2", ")", "{", "// Let's always iterate over smaller collection:", "if", "(", "c1", ".", "size", "(", ")", ">", "c...
Method that can be used to efficiently check if 2 collections share at least one common element. @return True if there is at least one element that's common to both Collections, ie. that is contained in both of them.
[ "Method", "that", "can", "be", "used", "to", "efficiently", "check", "if", "2", "collections", "share", "at", "least", "one", "common", "element", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/DataUtil.java#L83-L98
101,985
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/StreamScanner.java
StreamScanner.throwLazyError
protected void throwLazyError(Exception e) { if (e instanceof XMLStreamException) { WstxLazyException.throwLazily((XMLStreamException) e); } ExceptionUtil.throwRuntimeException(e); }
java
protected void throwLazyError(Exception e) { if (e instanceof XMLStreamException) { WstxLazyException.throwLazily((XMLStreamException) e); } ExceptionUtil.throwRuntimeException(e); }
[ "protected", "void", "throwLazyError", "(", "Exception", "e", ")", "{", "if", "(", "e", "instanceof", "XMLStreamException", ")", "{", "WstxLazyException", ".", "throwLazily", "(", "(", "XMLStreamException", ")", "e", ")", ";", "}", "ExceptionUtil", ".", "throw...
Method called to report an error, when caller's signature only allows runtime exceptions to be thrown.
[ "Method", "called", "to", "report", "an", "error", "when", "caller", "s", "signature", "only", "allows", "runtime", "exceptions", "to", "be", "thrown", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L734-L740
101,986
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/StreamScanner.java
StreamScanner.loadMore
protected boolean loadMore() throws XMLStreamException { WstxInputSource input = mInput; do { /* Need to make sure offsets are properly updated for error * reporting purposes, and do this now while previous amounts * are still known. */ ...
java
protected boolean loadMore() throws XMLStreamException { WstxInputSource input = mInput; do { /* Need to make sure offsets are properly updated for error * reporting purposes, and do this now while previous amounts * are still known. */ ...
[ "protected", "boolean", "loadMore", "(", ")", "throws", "XMLStreamException", "{", "WstxInputSource", "input", "=", "mInput", ";", "do", "{", "/* Need to make sure offsets are properly updated for error\n * reporting purposes, and do this now while previous amounts\n ...
Method that will try to read one or more characters from currently open input sources; closing input sources if necessary. @return true if reading succeeded (or may succeed), false if we reached EOF.
[ "Method", "that", "will", "try", "to", "read", "one", "or", "more", "characters", "from", "currently", "open", "input", "sources", ";", "closing", "input", "sources", "if", "necessary", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L997-L1051
101,987
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/StreamScanner.java
StreamScanner.validateChar
private final void validateChar(int value) throws XMLStreamException { /* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic, * need to be reported by a surrogate pair.. */ if (value >= 0xD800) { if (value < 0xE000) { // no surrogates via entity expans...
java
private final void validateChar(int value) throws XMLStreamException { /* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic, * need to be reported by a surrogate pair.. */ if (value >= 0xD800) { if (value < 0xE000) { // no surrogates via entity expans...
[ "private", "final", "void", "validateChar", "(", "int", "value", ")", "throws", "XMLStreamException", "{", "/* 24-Jan-2006, TSa: Ok, \"high\" Unicode chars are problematic,\n * need to be reported by a surrogate pair..\n */", "if", "(", "value", ">=", "0xD800", ")...
Method that will verify that expanded Unicode codepoint is a valid XML content character.
[ "Method", "that", "will", "verify", "that", "expanded", "Unicode", "codepoint", "is", "a", "valid", "XML", "content", "character", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L2390-L2419
101,988
FasterXML/woodstox
src/main/java/com/ctc/wstx/dom/DOMOutputElement.java
DOMOutputElement.createAndAttachChild
protected DOMOutputElement createAndAttachChild(Element element) { if (mRootNode != null) { mRootNode.appendChild(element); } else { mElement.appendChild(element); } return createChild(element); }
java
protected DOMOutputElement createAndAttachChild(Element element) { if (mRootNode != null) { mRootNode.appendChild(element); } else { mElement.appendChild(element); } return createChild(element); }
[ "protected", "DOMOutputElement", "createAndAttachChild", "(", "Element", "element", ")", "{", "if", "(", "mRootNode", "!=", "null", ")", "{", "mRootNode", ".", "appendChild", "(", "element", ")", ";", "}", "else", "{", "mElement", ".", "appendChild", "(", "e...
Simplest factory method, which gets called when a 1-argument element output method is called. It is, then, assumed to use the default namespace. Will both create the child element and attach it to parent element, or lacking own owner document.
[ "Simplest", "factory", "method", "which", "gets", "called", "when", "a", "1", "-", "argument", "element", "output", "method", "is", "called", ".", "It", "is", "then", "assumed", "to", "use", "the", "default", "namespace", ".", "Will", "both", "create", "th...
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dom/DOMOutputElement.java#L98-L106
101,989
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.decode
public void decode(TypedValueDecoder tvd) throws IllegalArgumentException { char[] buf; int start, end; if (mInputStart >= 0) { // shared buffer, common case buf = mInputBuffer; start = mInputStart; end = start + mInputLen; } else { ...
java
public void decode(TypedValueDecoder tvd) throws IllegalArgumentException { char[] buf; int start, end; if (mInputStart >= 0) { // shared buffer, common case buf = mInputBuffer; start = mInputStart; end = start + mInputLen; } else { ...
[ "public", "void", "decode", "(", "TypedValueDecoder", "tvd", ")", "throws", "IllegalArgumentException", "{", "char", "[", "]", "buf", ";", "int", "start", ",", "end", ";", "if", "(", "mInputStart", ">=", "0", ")", "{", "// shared buffer, common case", "buf", ...
Generic pass-through method which call given decoder with accumulated data
[ "Generic", "pass", "-", "through", "method", "which", "call", "given", "decoder", "with", "accumulated", "data" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L412-L442
101,990
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.decodeElements
public int decodeElements(TypedArrayDecoder tad, InputProblemReporter rep) throws TypedXMLStreamException { int count = 0; /* First: for simplicity, we require a single flat buffer to * decode from. Second: to be able to update start location * (to keep track of what's ava...
java
public int decodeElements(TypedArrayDecoder tad, InputProblemReporter rep) throws TypedXMLStreamException { int count = 0; /* First: for simplicity, we require a single flat buffer to * decode from. Second: to be able to update start location * (to keep track of what's ava...
[ "public", "int", "decodeElements", "(", "TypedArrayDecoder", "tad", ",", "InputProblemReporter", "rep", ")", "throws", "TypedXMLStreamException", "{", "int", "count", "=", "0", ";", "/* First: for simplicity, we require a single flat buffer to\n * decode from. Second: to ...
Pass-through decode method called to find find the next token, decode it, and repeat the process as long as there are more tokens and the array decoder accepts more entries. All tokens processed will be "consumed", such that they will not be visible via buffer. @return Number of tokens decoded; 0 means that no (more) ...
[ "Pass", "-", "through", "decode", "method", "called", "to", "find", "find", "the", "next", "token", "decode", "it", "and", "repeat", "the", "process", "as", "long", "as", "there", "are", "more", "tokens", "and", "the", "array", "decoder", "accepts", "more"...
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L454-L523
101,991
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.initBinaryChunks
public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mIn...
java
public void initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, boolean firstChunk) { if (mInputStart < 0) { // non-shared dec.init(v, firstChunk, mCurrentSegment, 0, mCurrentSize, mSegments); } else { // shared dec.init(v, firstChunk, mInputBuffer, mInputStart, mIn...
[ "public", "void", "initBinaryChunks", "(", "Base64Variant", "v", ",", "CharArrayBase64Decoder", "dec", ",", "boolean", "firstChunk", ")", "{", "if", "(", "mInputStart", "<", "0", ")", "{", "// non-shared", "dec", ".", "init", "(", "v", ",", "firstChunk", ","...
Method that needs to be called to configure given base64 decoder with textual contents collected by this buffer. @param dec Decoder that will need data @param firstChunk Whether this is the first segment fed or not; if it is, state needs to be fullt reset; if not, only partially.
[ "Method", "that", "needs", "to", "be", "called", "to", "configure", "given", "base64", "decoder", "with", "textual", "contents", "collected", "by", "this", "buffer", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L533-L540
101,992
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.rawContentsTo
public int rawContentsTo(Writer w) throws IOException { // Let's first see if we have created helper objects: if (mResultArray != null) { w.write(mResultArray); return mResultArray.length; } if (mResultString != null) { w.write(mResultStrin...
java
public int rawContentsTo(Writer w) throws IOException { // Let's first see if we have created helper objects: if (mResultArray != null) { w.write(mResultArray); return mResultArray.length; } if (mResultString != null) { w.write(mResultStrin...
[ "public", "int", "rawContentsTo", "(", "Writer", "w", ")", "throws", "IOException", "{", "// Let's first see if we have created helper objects:", "if", "(", "mResultArray", "!=", "null", ")", "{", "w", ".", "write", "(", "mResultArray", ")", ";", "return", "mResul...
Method that will stream contents of this buffer into specified Writer.
[ "Method", "that", "will", "stream", "contents", "of", "this", "buffer", "into", "specified", "Writer", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L723-L757
101,993
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.endsWith
public boolean endsWith(String str) { /* Let's just play this safe; should seldom if ever happen... * and because of that, can be sub-optimal, performancewise, to * alternatives. */ if (mInputStart >= 0) { unshare(16); } int segIndex = (mSegmen...
java
public boolean endsWith(String str) { /* Let's just play this safe; should seldom if ever happen... * and because of that, can be sub-optimal, performancewise, to * alternatives. */ if (mInputStart >= 0) { unshare(16); } int segIndex = (mSegmen...
[ "public", "boolean", "endsWith", "(", "String", "str", ")", "{", "/* Let's just play this safe; should seldom if ever happen...\n * and because of that, can be sub-optimal, performancewise, to\n * alternatives.\n */", "if", "(", "mInputStart", ">=", "0", ")", "{...
Method that can be used to check if the contents of the buffer end in specified String. @return True if the textual content buffer contains ends with the specified String; false otherwise
[ "Method", "that", "can", "be", "used", "to", "check", "if", "the", "contents", "of", "the", "buffer", "end", "in", "specified", "String", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L827-L859
101,994
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.calcNewSize
private int calcNewSize(int latestSize) { // Let's grow segments by 50%, when over 8k int incr = (latestSize < 8000) ? latestSize : (latestSize >> 1); int size = latestSize + incr; // but let's not create too big chunks return Math.min(size, MAX_SEGMENT_LENGTH); }
java
private int calcNewSize(int latestSize) { // Let's grow segments by 50%, when over 8k int incr = (latestSize < 8000) ? latestSize : (latestSize >> 1); int size = latestSize + incr; // but let's not create too big chunks return Math.min(size, MAX_SEGMENT_LENGTH); }
[ "private", "int", "calcNewSize", "(", "int", "latestSize", ")", "{", "// Let's grow segments by 50%, when over 8k", "int", "incr", "=", "(", "latestSize", "<", "8000", ")", "?", "latestSize", ":", "(", "latestSize", ">>", "1", ")", ";", "int", "size", "=", "...
Method used to determine size of the next segment to allocate to contain textual content.
[ "Method", "used", "to", "determine", "size", "of", "the", "next", "segment", "to", "allocate", "to", "contain", "textual", "content", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L1155-L1162
101,995
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.expand
private void expand(int roomNeeded) { // First, let's move current segment to segment list: if (mSegments == null) { mSegments = new ArrayList<char[]>(); } char[] curr = mCurrentSegment; mHasSegments = true; mSegments.add(curr); int oldLen = curr.l...
java
private void expand(int roomNeeded) { // First, let's move current segment to segment list: if (mSegments == null) { mSegments = new ArrayList<char[]>(); } char[] curr = mCurrentSegment; mHasSegments = true; mSegments.add(curr); int oldLen = curr.l...
[ "private", "void", "expand", "(", "int", "roomNeeded", ")", "{", "// First, let's move current segment to segment list:", "if", "(", "mSegments", "==", "null", ")", "{", "mSegments", "=", "new", "ArrayList", "<", "char", "[", "]", ">", "(", ")", ";", "}", "c...
Method called when current segment is full, to allocate new segment. @param roomNeeded Number of characters that the resulting new buffer must have
[ "Method", "called", "when", "current", "segment", "is", "full", "to", "allocate", "new", "segment", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L1218-L1233
101,996
FasterXML/woodstox
src/main/java/com/ctc/wstx/io/BranchingReaderSource.java
BranchingReaderSource.endBranch
public void endBranch(int endOffset) { if (mBranchBuffer != null) { if (endOffset > mBranchStartOffset) { appendBranched(mBranchStartOffset, endOffset); } // Let's also make sure no branching is done from this point on: mBranchBuffer = null; ...
java
public void endBranch(int endOffset) { if (mBranchBuffer != null) { if (endOffset > mBranchStartOffset) { appendBranched(mBranchStartOffset, endOffset); } // Let's also make sure no branching is done from this point on: mBranchBuffer = null; ...
[ "public", "void", "endBranch", "(", "int", "endOffset", ")", "{", "if", "(", "mBranchBuffer", "!=", "null", ")", "{", "if", "(", "endOffset", ">", "mBranchStartOffset", ")", "{", "appendBranched", "(", "mBranchStartOffset", ",", "endOffset", ")", ";", "}", ...
Currently this input source does not implement branching
[ "Currently", "this", "input", "source", "does", "not", "implement", "branching" ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/BranchingReaderSource.java#L97-L106
101,997
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/XmlWriter.java
XmlWriter.verifyNameValidity
public final void verifyNameValidity(String name, boolean checkNs) throws XMLStreamException { /* No empty names... caller must have dealt with optional arguments * prior to calling this method */ if (name == null || name.length() == 0) { reportNwfName(ErrorCons...
java
public final void verifyNameValidity(String name, boolean checkNs) throws XMLStreamException { /* No empty names... caller must have dealt with optional arguments * prior to calling this method */ if (name == null || name.length() == 0) { reportNwfName(ErrorCons...
[ "public", "final", "void", "verifyNameValidity", "(", "String", "name", ",", "boolean", "checkNs", ")", "throws", "XMLStreamException", "{", "/* No empty names... caller must have dealt with optional arguments\n * prior to calling this method\n */", "if", "(", "name...
Method called to verify that the name is a legal XML name.
[ "Method", "called", "to", "verify", "that", "the", "name", "is", "a", "legal", "XML", "name", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/XmlWriter.java#L546-L564
101,998
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java
BaseStreamWriter.addDefaultAttribute
@Override public int addDefaultAttribute(String localName, String uri, String prefix, String value) { // nothing to do, but to indicate we didn't add it... return -1; }
java
@Override public int addDefaultAttribute(String localName, String uri, String prefix, String value) { // nothing to do, but to indicate we didn't add it... return -1; }
[ "@", "Override", "public", "int", "addDefaultAttribute", "(", "String", "localName", ",", "String", "uri", ",", "String", "prefix", ",", "String", "value", ")", "{", "// nothing to do, but to indicate we didn't add it...", "return", "-", "1", ";", "}" ]
Adding default attribute values does not usually make sense on output side, so the implementation is a NOP for now.
[ "Adding", "default", "attribute", "values", "does", "not", "usually", "make", "sense", "on", "output", "side", "so", "the", "implementation", "is", "a", "NOP", "for", "now", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java#L1257-L1263
101,999
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/BasicStreamReader.java
BasicStreamReader.handleStartElem
private final void handleStartElem(char c) throws XMLStreamException { mTokenState = TOKEN_FULL_COALESCED; boolean empty; if (mCfgNsEnabled) { String str = parseLocalName(c); c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++] : getNextCha...
java
private final void handleStartElem(char c) throws XMLStreamException { mTokenState = TOKEN_FULL_COALESCED; boolean empty; if (mCfgNsEnabled) { String str = parseLocalName(c); c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++] : getNextCha...
[ "private", "final", "void", "handleStartElem", "(", "char", "c", ")", "throws", "XMLStreamException", "{", "mTokenState", "=", "TOKEN_FULL_COALESCED", ";", "boolean", "empty", ";", "if", "(", "mCfgNsEnabled", ")", "{", "String", "str", "=", "parseLocalName", "("...
Method that takes care of parsing of start elements; including full parsing of namespace declarations and attributes, as well as namespace resolution.
[ "Method", "that", "takes", "care", "of", "parsing", "of", "start", "elements", ";", "including", "full", "parsing", "of", "namespace", "declarations", "and", "attributes", "as", "well", "as", "namespace", "resolution", "." ]
ffcaabdc06672d9564c48c25d601d029b7fd6548
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/BasicStreamReader.java#L3004-L3052