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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
115,600 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.handle | public static boolean handle(InputStream is, String name, ZipEntryCallback action) {
SingleZipEntryCallback helper = new SingleZipEntryCallback(name, action);
iterate(is, helper);
return helper.found();
} | java | public static boolean handle(InputStream is, String name, ZipEntryCallback action) {
SingleZipEntryCallback helper = new SingleZipEntryCallback(name, action);
iterate(is, helper);
return helper.found();
} | [
"public",
"static",
"boolean",
"handle",
"(",
"InputStream",
"is",
",",
"String",
"name",
",",
"ZipEntryCallback",
"action",
")",
"{",
"SingleZipEntryCallback",
"helper",
"=",
"new",
"SingleZipEntryCallback",
"(",
"name",
",",
"action",
")",
";",
"iterate",
"(",... | Reads the given ZIP stream and executes the given action for a single
entry.
@param is
input ZIP stream (it will not be closed automatically).
@param name
entry name.
@param action
action to be called for this entry.
@return <code>true</code> if the entry was found, <code>false</code> if the
entry was not found.
@see... | [
"Reads",
"the",
"given",
"ZIP",
"stream",
"and",
"executes",
"the",
"given",
"action",
"for",
"a",
"single",
"entry",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L889-L893 |
115,601 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.unpack | public static void unpack(File zip, final File outputDir, Charset charset) {
unpack(zip, outputDir, IdentityNameMapper.INSTANCE, charset);
} | java | public static void unpack(File zip, final File outputDir, Charset charset) {
unpack(zip, outputDir, IdentityNameMapper.INSTANCE, charset);
} | [
"public",
"static",
"void",
"unpack",
"(",
"File",
"zip",
",",
"final",
"File",
"outputDir",
",",
"Charset",
"charset",
")",
"{",
"unpack",
"(",
"zip",
",",
"outputDir",
",",
"IdentityNameMapper",
".",
"INSTANCE",
",",
"charset",
")",
";",
"}"
] | Unpacks a ZIP file to the given directory using a specific Charset
for the input file.
<p>
The output directory must not be a file.
@param zip
input ZIP file.
@param outputDir
output directory (created automatically if not found).
@param charset
charset used to unpack the zip file | [
"Unpacks",
"a",
"ZIP",
"file",
"to",
"the",
"given",
"directory",
"using",
"a",
"specific",
"Charset",
"for",
"the",
"input",
"file",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L957-L959 |
115,602 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.packEntry | public static byte[] packEntry(File file) {
log.trace("Compressing '{}' into a ZIP file with single entry.", file);
ByteArrayOutputStream result = new ByteArrayOutputStream();
try {
ZipOutputStream out = new ZipOutputStream(result);
ZipEntry entry = ZipEntryUtil.fromFile(file.getName(), file);
... | java | public static byte[] packEntry(File file) {
log.trace("Compressing '{}' into a ZIP file with single entry.", file);
ByteArrayOutputStream result = new ByteArrayOutputStream();
try {
ZipOutputStream out = new ZipOutputStream(result);
ZipEntry entry = ZipEntryUtil.fromFile(file.getName(), file);
... | [
"public",
"static",
"byte",
"[",
"]",
"packEntry",
"(",
"File",
"file",
")",
"{",
"log",
".",
"trace",
"(",
"\"Compressing '{}' into a ZIP file with single entry.\"",
",",
"file",
")",
";",
"ByteArrayOutputStream",
"result",
"=",
"new",
"ByteArrayOutputStream",
"(",... | Compresses the given file into a ZIP file with single entry.
@param file file to be compressed.
@return ZIP file created. | [
"Compresses",
"the",
"given",
"file",
"into",
"a",
"ZIP",
"file",
"with",
"single",
"entry",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1350-L1370 |
115,603 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | private static void pack(File dir, ZipOutputStream out, NameMapper mapper, String pathPrefix, boolean mustHaveChildren) throws IOException {
String[] filenames = dir.list();
if (filenames == null) {
if (!dir.exists()) {
throw new ZipException("Given file '" + dir + "' doesn't exist!");
}
... | java | private static void pack(File dir, ZipOutputStream out, NameMapper mapper, String pathPrefix, boolean mustHaveChildren) throws IOException {
String[] filenames = dir.list();
if (filenames == null) {
if (!dir.exists()) {
throw new ZipException("Given file '" + dir + "' doesn't exist!");
}
... | [
"private",
"static",
"void",
"pack",
"(",
"File",
"dir",
",",
"ZipOutputStream",
"out",
",",
"NameMapper",
"mapper",
",",
"String",
"pathPrefix",
",",
"boolean",
"mustHaveChildren",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"filenames",
"=",
"dir"... | Compresses the given directory and all its sub-directories into a ZIP file.
@param dir
root directory.
@param out
ZIP output stream.
@param mapper
call-back for renaming the entries.
@param pathPrefix
prefix to be used for the entries.
@param mustHaveChildren
if true, but directory to pack doesn't have any files, thro... | [
"Compresses",
"the",
"given",
"directory",
"and",
"all",
"its",
"sub",
"-",
"directories",
"into",
"a",
"ZIP",
"file",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1735-L1777 |
115,604 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.createEmpty | public static void createEmpty(File file) {
// https://en.wikipedia.org/wiki/Zip_(file_format)#Limits
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
fos.write(new byte[] {0x50,0x4B,0x05,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0... | java | public static void createEmpty(File file) {
// https://en.wikipedia.org/wiki/Zip_(file_format)#Limits
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
fos.write(new byte[] {0x50,0x4B,0x05,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0... | [
"public",
"static",
"void",
"createEmpty",
"(",
"File",
"file",
")",
"{",
"// https://en.wikipedia.org/wiki/Zip_(file_format)#Limits",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"fos",
"."... | Creates an empty ZIP archive at the location of the provided file.
@param file the file to become an empty ZIP archive | [
"Creates",
"an",
"empty",
"ZIP",
"archive",
"at",
"the",
"location",
"of",
"the",
"provided",
"file",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1862-L1875 |
115,605 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(ZipEntrySource[] entries, OutputStream os) {
if (log.isDebugEnabled()) {
log.debug("Creating stream from {}.", Arrays.asList(entries));
}
pack(entries, os, false);
} | java | public static void pack(ZipEntrySource[] entries, OutputStream os) {
if (log.isDebugEnabled()) {
log.debug("Creating stream from {}.", Arrays.asList(entries));
}
pack(entries, os, false);
} | [
"public",
"static",
"void",
"pack",
"(",
"ZipEntrySource",
"[",
"]",
"entries",
",",
"OutputStream",
"os",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Creating stream from {}.\"",
",",
"Arrays",
".",
... | Compresses the given entries into an output stream.
@param entries
ZIP entries added.
@param os
output stream for the new ZIP (does not have to be buffered)
@since 1.9 | [
"Compresses",
"the",
"given",
"entries",
"into",
"an",
"output",
"stream",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1964-L1969 |
115,606 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(ZipEntrySource[] entries, File zip) {
if (log.isDebugEnabled()) {
log.debug("Creating '{}' from {}.", zip, Arrays.asList(entries));
}
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(zip));
pack(entries, out, true);
}
c... | java | public static void pack(ZipEntrySource[] entries, File zip) {
if (log.isDebugEnabled()) {
log.debug("Creating '{}' from {}.", zip, Arrays.asList(entries));
}
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(zip));
pack(entries, out, true);
}
c... | [
"public",
"static",
"void",
"pack",
"(",
"ZipEntrySource",
"[",
"]",
"entries",
",",
"File",
"zip",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Creating '{}' from {}.\"",
",",
"zip",
",",
"Arrays",
... | Compresses the given entries into a new ZIP file.
@param entries
ZIP entries added.
@param zip
new ZIP file created. | [
"Compresses",
"the",
"given",
"entries",
"into",
"a",
"new",
"ZIP",
"file",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1996-L2012 |
115,607 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.removeEntry | public static void removeEntry(File zip, String path, File destZip) {
removeEntries(zip, new String[] { path }, destZip);
} | java | public static void removeEntry(File zip, String path, File destZip) {
removeEntries(zip, new String[] { path }, destZip);
} | [
"public",
"static",
"void",
"removeEntry",
"(",
"File",
"zip",
",",
"String",
"path",
",",
"File",
"destZip",
")",
"{",
"removeEntries",
"(",
"zip",
",",
"new",
"String",
"[",
"]",
"{",
"path",
"}",
",",
"destZip",
")",
";",
"}"
] | Copies an existing ZIP file and removes entry with a given path.
@param zip
an existing ZIP file (only read)
@param path
path of the entry to remove
@param destZip
new ZIP file created.
@since 1.7 | [
"Copies",
"an",
"existing",
"ZIP",
"file",
"and",
"removes",
"entry",
"with",
"a",
"given",
"path",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2270-L2272 |
115,608 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.copyEntries | private static void copyEntries(File zip, final ZipOutputStream out) {
// this one doesn't call copyEntries with ignoredEntries, because that has poorer performance
final Set<String> names = new HashSet<String>();
iterate(zip, new ZipEntryCallback() {
public void process(InputStream in, ZipEntry zipEn... | java | private static void copyEntries(File zip, final ZipOutputStream out) {
// this one doesn't call copyEntries with ignoredEntries, because that has poorer performance
final Set<String> names = new HashSet<String>();
iterate(zip, new ZipEntryCallback() {
public void process(InputStream in, ZipEntry zipEn... | [
"private",
"static",
"void",
"copyEntries",
"(",
"File",
"zip",
",",
"final",
"ZipOutputStream",
"out",
")",
"{",
"// this one doesn't call copyEntries with ignoredEntries, because that has poorer performance",
"final",
"Set",
"<",
"String",
">",
"names",
"=",
"new",
"Has... | Copies all entries from one ZIP file to another.
@param zip
source ZIP file.
@param out
target ZIP stream. | [
"Copies",
"all",
"entries",
"from",
"one",
"ZIP",
"file",
"to",
"another",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2373-L2387 |
115,609 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.copyEntries | private static void copyEntries(File zip, final ZipOutputStream out, final Set<String> ignoredEntries) {
final Set<String> names = new HashSet<String>();
final Set<String> dirNames = filterDirEntries(zip, ignoredEntries);
iterate(zip, new ZipEntryCallback() {
public void process(InputStream in, ZipEnt... | java | private static void copyEntries(File zip, final ZipOutputStream out, final Set<String> ignoredEntries) {
final Set<String> names = new HashSet<String>();
final Set<String> dirNames = filterDirEntries(zip, ignoredEntries);
iterate(zip, new ZipEntryCallback() {
public void process(InputStream in, ZipEnt... | [
"private",
"static",
"void",
"copyEntries",
"(",
"File",
"zip",
",",
"final",
"ZipOutputStream",
"out",
",",
"final",
"Set",
"<",
"String",
">",
"ignoredEntries",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"names",
"=",
"new",
"HashSet",
"<",
"String",
... | Copies all entries from one ZIP file to another, ignoring entries with path in ignoredEntries
@param zip
source ZIP file.
@param out
target ZIP stream.
@param ignoredEntries
paths of entries not to copy | [
"Copies",
"all",
"entries",
"from",
"one",
"ZIP",
"file",
"to",
"another",
"ignoring",
"entries",
"with",
"path",
"in",
"ignoredEntries"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2423-L2447 |
115,610 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.replaceEntries | public static boolean replaceEntries(File zip, ZipEntrySource[] entries, File destZip) {
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to '" + destZip + "' and replacing entries " + Arrays.asList(entries) + ".");
}
final Map<String, ZipEntrySource> entryByPath = entriesByPath(entries);... | java | public static boolean replaceEntries(File zip, ZipEntrySource[] entries, File destZip) {
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to '" + destZip + "' and replacing entries " + Arrays.asList(entries) + ".");
}
final Map<String, ZipEntrySource> entryByPath = entriesByPath(entries);... | [
"public",
"static",
"boolean",
"replaceEntries",
"(",
"File",
"zip",
",",
"ZipEntrySource",
"[",
"]",
"entries",
",",
"File",
"destZip",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Copying '\"",
"+"... | Copies an existing ZIP file and replaces the given entries in it.
@param zip
an existing ZIP file (only read).
@param entries
new ZIP entries to be replaced with.
@param destZip
new ZIP file created.
@return <code>true</code> if at least one entry was replaced. | [
"Copies",
"an",
"existing",
"ZIP",
"file",
"and",
"replaces",
"the",
"given",
"entries",
"in",
"it",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2626-L2662 |
115,611 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/FileSource.java | FileSource.pair | public static FileSource[] pair(File[] files, String[] names) {
if (files.length > names.length) {
throw new IllegalArgumentException("names array must contain " +
"at least the same amount of items as files array or more");
}
FileSource[] result = new FileSource[files.length];
f... | java | public static FileSource[] pair(File[] files, String[] names) {
if (files.length > names.length) {
throw new IllegalArgumentException("names array must contain " +
"at least the same amount of items as files array or more");
}
FileSource[] result = new FileSource[files.length];
f... | [
"public",
"static",
"FileSource",
"[",
"]",
"pair",
"(",
"File",
"[",
"]",
"files",
",",
"String",
"[",
"]",
"names",
")",
"{",
"if",
"(",
"files",
".",
"length",
">",
"names",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Creates a sequence of FileSource objects via mapping
a sequence of files to the sequence of corresponding names
for the entries
@param files file array to form the data of the objects
in the resulting array
@param names file array to form the names of the objects
in the resulting array
@return array of FileSource objec... | [
"Creates",
"a",
"sequence",
"of",
"FileSource",
"objects",
"via",
"mapping",
"a",
"sequence",
"of",
"files",
"to",
"the",
"sequence",
"of",
"corresponding",
"names",
"for",
"the",
"entries"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/FileSource.java#L75-L86 |
115,612 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/transform/FileZipEntryTransformer.java | FileZipEntryTransformer.transform | public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out) throws IOException {
File inFile = null;
File outFile = null;
try {
inFile = File.createTempFile("zip", null);
outFile = File.createTempFile("zip", null);
copy(in, inFile);
transform(zipEntry, inFile, outFi... | java | public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out) throws IOException {
File inFile = null;
File outFile = null;
try {
inFile = File.createTempFile("zip", null);
outFile = File.createTempFile("zip", null);
copy(in, inFile);
transform(zipEntry, inFile, outFi... | [
"public",
"void",
"transform",
"(",
"InputStream",
"in",
",",
"ZipEntry",
"zipEntry",
",",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"File",
"inFile",
"=",
"null",
";",
"File",
"outFile",
"=",
"null",
";",
"try",
"{",
"inFile",
"=",
"Fil... | Copies the input stream to the file, then transforms the file.
FileSource is added then to the output stream.
@param in
input stream of the entry contents
@param zipEntry
zip entry metadata
@param out
ignored, because we're working on files
@throws IOException if anything goes wrong | [
"Copies",
"the",
"input",
"stream",
"to",
"the",
"file",
"then",
"transforms",
"the",
"file",
".",
"FileSource",
"is",
"added",
"then",
"to",
"the",
"output",
"stream",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/transform/FileZipEntryTransformer.java#L46-L61 |
115,613 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java | AsiExtraField.getLocalFileDataData | public byte[] getLocalFileDataData() {
// CRC will be added later
byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
byte[] linkArray = getLinkedFile().getBytes(); // Uses default charset - see class Javadoc
// CheckSty... | java | public byte[] getLocalFileDataData() {
// CRC will be added later
byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
byte[] linkArray = getLinkedFile().getBytes(); // Uses default charset - see class Javadoc
// CheckSty... | [
"public",
"byte",
"[",
"]",
"getLocalFileDataData",
"(",
")",
"{",
"// CRC will be added later",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"getLocalFileDataLength",
"(",
")",
".",
"getValue",
"(",
")",
"-",
"WORD",
"]",
";",
"System",
".",
"arrayc... | The actual data to put into local file data - without Header-ID
or length specifier.
@return get the data
@since 1.1 | [
"The",
"actual",
"data",
"to",
"put",
"into",
"local",
"file",
"data",
"-",
"without",
"Header",
"-",
"ID",
"or",
"length",
"specifier",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java#L206-L232 |
115,614 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java | AsiExtraField.parseFromLocalFileData | public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
long givenChecksum = ZipLong.getValue(data, offset);
byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
long realChe... | java | public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
long givenChecksum = ZipLong.getValue(data, offset);
byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
long realChe... | [
"public",
"void",
"parseFromLocalFileData",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"ZipException",
"{",
"long",
"givenChecksum",
"=",
"ZipLong",
".",
"getValue",
"(",
"data",
",",
"offset",
")",
";",
"byte... | Populate data from this array as if it was in local file data.
@param data an array of bytes
@param offset the start offset
@param length the number of bytes in the array from offset
@since 1.1
@throws ZipException on error | [
"Populate",
"data",
"from",
"this",
"array",
"as",
"if",
"it",
"was",
"in",
"local",
"file",
"data",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java#L369-L401 |
115,615 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java | AsiExtraField.getMode | protected int getMode(int mode) {
int type = FILE_FLAG;
if (isLink()) {
type = LINK_FLAG;
}
else if (isDirectory()) {
type = DIR_FLAG;
}
return type | (mode & PERM_MASK);
} | java | protected int getMode(int mode) {
int type = FILE_FLAG;
if (isLink()) {
type = LINK_FLAG;
}
else if (isDirectory()) {
type = DIR_FLAG;
}
return type | (mode & PERM_MASK);
} | [
"protected",
"int",
"getMode",
"(",
"int",
"mode",
")",
"{",
"int",
"type",
"=",
"FILE_FLAG",
";",
"if",
"(",
"isLink",
"(",
")",
")",
"{",
"type",
"=",
"LINK_FLAG",
";",
"}",
"else",
"if",
"(",
"isDirectory",
"(",
")",
")",
"{",
"type",
"=",
"DI... | Get the file mode for given permissions with the correct file type.
@param mode the mode
@return the type with the mode
@since 1.1 | [
"Get",
"the",
"file",
"mode",
"for",
"given",
"permissions",
"with",
"the",
"correct",
"file",
"type",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java#L410-L419 |
115,616 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java | ZipEntryUtil.copy | static ZipEntry copy(ZipEntry original, String newName) {
ZipEntry copy = new ZipEntry(newName == null ? original.getName() : newName);
if (original.getCrc() != -1) {
copy.setCrc(original.getCrc());
}
if (original.getMethod() != -1) {
copy.setMethod(original.getMethod());
}
if (origi... | java | static ZipEntry copy(ZipEntry original, String newName) {
ZipEntry copy = new ZipEntry(newName == null ? original.getName() : newName);
if (original.getCrc() != -1) {
copy.setCrc(original.getCrc());
}
if (original.getMethod() != -1) {
copy.setMethod(original.getMethod());
}
if (origi... | [
"static",
"ZipEntry",
"copy",
"(",
"ZipEntry",
"original",
",",
"String",
"newName",
")",
"{",
"ZipEntry",
"copy",
"=",
"new",
"ZipEntry",
"(",
"newName",
"==",
"null",
"?",
"original",
".",
"getName",
"(",
")",
":",
"newName",
")",
";",
"if",
"(",
"or... | Copy entry with another name.
@param original - zipEntry to copy
@param newName - new entry name, optional, if null, ogirinal's entry
@return copy of the original entry, but with the given name | [
"Copy",
"entry",
"with",
"another",
"name",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java#L60-L78 |
115,617 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java | ZipEntryUtil.copyEntry | static void copyEntry(ZipEntry zipEntry, InputStream in, ZipOutputStream out) throws IOException {
copyEntry(zipEntry, in, out, true);
} | java | static void copyEntry(ZipEntry zipEntry, InputStream in, ZipOutputStream out) throws IOException {
copyEntry(zipEntry, in, out, true);
} | [
"static",
"void",
"copyEntry",
"(",
"ZipEntry",
"zipEntry",
",",
"InputStream",
"in",
",",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"copyEntry",
"(",
"zipEntry",
",",
"in",
",",
"out",
",",
"true",
")",
";",
"}"
] | Copies a given ZIP entry to a ZIP file.
@param zipEntry
a ZIP entry from existing ZIP file.
@param in
contents of the ZIP entry.
@param out
target ZIP stream. | [
"Copies",
"a",
"given",
"ZIP",
"entry",
"to",
"a",
"ZIP",
"file",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java#L90-L92 |
115,618 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java | ZipEntryUtil.copyEntry | static void copyEntry(ZipEntry originalEntry, InputStream in, ZipOutputStream out, boolean preserveTimestamps) throws IOException {
ZipEntry copy = copy(originalEntry);
if (preserveTimestamps) {
TimestampStrategyFactory.getInstance().setTime(copy, originalEntry);
}
else {
copy.setTime(Syste... | java | static void copyEntry(ZipEntry originalEntry, InputStream in, ZipOutputStream out, boolean preserveTimestamps) throws IOException {
ZipEntry copy = copy(originalEntry);
if (preserveTimestamps) {
TimestampStrategyFactory.getInstance().setTime(copy, originalEntry);
}
else {
copy.setTime(Syste... | [
"static",
"void",
"copyEntry",
"(",
"ZipEntry",
"originalEntry",
",",
"InputStream",
"in",
",",
"ZipOutputStream",
"out",
",",
"boolean",
"preserveTimestamps",
")",
"throws",
"IOException",
"{",
"ZipEntry",
"copy",
"=",
"copy",
"(",
"originalEntry",
")",
";",
"i... | Copies a given ZIP entry to a ZIP file. If this.preserveTimestamps is true, original timestamp
is carried over, otherwise uses current time.
@param originalEntry
a ZIP entry from existing ZIP file.
@param in
contents of the ZIP entry.
@param out
target ZIP stream. | [
"Copies",
"a",
"given",
"ZIP",
"entry",
"to",
"a",
"ZIP",
"file",
".",
"If",
"this",
".",
"preserveTimestamps",
"is",
"true",
"original",
"timestamp",
"is",
"carried",
"over",
"otherwise",
"uses",
"current",
"time",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java#L105-L116 |
115,619 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java | ZipEntryUtil.fromFile | static ZipEntry fromFile(String name, File file) {
ZipEntry zipEntry = new ZipEntry(name);
if (!file.isDirectory()) {
zipEntry.setSize(file.length());
}
zipEntry.setTime(file.lastModified());
ZTFilePermissions permissions = ZTFilePermissionsUtil.getDefaultStategy().getPermissions(file);
i... | java | static ZipEntry fromFile(String name, File file) {
ZipEntry zipEntry = new ZipEntry(name);
if (!file.isDirectory()) {
zipEntry.setSize(file.length());
}
zipEntry.setTime(file.lastModified());
ZTFilePermissions permissions = ZTFilePermissionsUtil.getDefaultStategy().getPermissions(file);
i... | [
"static",
"ZipEntry",
"fromFile",
"(",
"String",
"name",
",",
"File",
"file",
")",
"{",
"ZipEntry",
"zipEntry",
"=",
"new",
"ZipEntry",
"(",
"name",
")",
";",
"if",
"(",
"!",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"zipEntry",
".",
"setSize",
... | Create new Zip entry and fill it with associated with file meta-info
@param name Zip entry name
@param file source File
@return newly created Zip entry | [
"Create",
"new",
"Zip",
"entry",
"and",
"fill",
"it",
"with",
"associated",
"with",
"file",
"meta",
"-",
"info"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java#L143-L155 |
115,620 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ExtraFieldUtils.java | ExtraFieldUtils.register | public static void register(Class<?> c) {
try {
ZipExtraField ze = (ZipExtraField) c.newInstance();
implementations.put(ze.getHeaderId(), c);
}
catch (ClassCastException cc) {
throw new RuntimeException(c + " doesn\'t implement ZipExtraField");
}
catch (InstantiationException ie) {... | java | public static void register(Class<?> c) {
try {
ZipExtraField ze = (ZipExtraField) c.newInstance();
implementations.put(ze.getHeaderId(), c);
}
catch (ClassCastException cc) {
throw new RuntimeException(c + " doesn\'t implement ZipExtraField");
}
catch (InstantiationException ie) {... | [
"public",
"static",
"void",
"register",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"try",
"{",
"ZipExtraField",
"ze",
"=",
"(",
"ZipExtraField",
")",
"c",
".",
"newInstance",
"(",
")",
";",
"implementations",
".",
"put",
"(",
"ze",
".",
"getHeaderId",... | Register a ZipExtraField implementation.
<p>
The given class must have a no-arg constructor and implement the {@link ZipExtraField ZipExtraField interface}.
</p>
@param c the class to register
@since 1.1 | [
"Register",
"a",
"ZipExtraField",
"implementation",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ExtraFieldUtils.java#L63-L77 |
115,621 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ExtraFieldUtils.java | ExtraFieldUtils.parse | public static List<ZipExtraField> parse(byte[] data) throws ZipException {
List<ZipExtraField> v = new ArrayList<ZipExtraField>();
if (data == null) {
return v;
}
int start = 0;
while (start <= data.length - WORD) {
ZipShort headerId = new ZipShort(data, start);
int length = (new Z... | java | public static List<ZipExtraField> parse(byte[] data) throws ZipException {
List<ZipExtraField> v = new ArrayList<ZipExtraField>();
if (data == null) {
return v;
}
int start = 0;
while (start <= data.length - WORD) {
ZipShort headerId = new ZipShort(data, start);
int length = (new Z... | [
"public",
"static",
"List",
"<",
"ZipExtraField",
">",
"parse",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"ZipException",
"{",
"List",
"<",
"ZipExtraField",
">",
"v",
"=",
"new",
"ArrayList",
"<",
"ZipExtraField",
">",
"(",
")",
";",
"if",
"(",
"da... | Split the array into ExtraFields and populate them with the
given data as local file data, throwing an exception if the
data cannot be parsed.
@param data an array of bytes as it appears in local file data
@return an array of ExtraFields
@throws ZipException on error | [
"Split",
"the",
"array",
"into",
"ExtraFields",
"and",
"populate",
"them",
"with",
"the",
"given",
"data",
"as",
"local",
"file",
"data",
"throwing",
"an",
"exception",
"if",
"the",
"data",
"cannot",
"be",
"parsed",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ExtraFieldUtils.java#L114-L145 |
115,622 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ExtraFieldUtils.java | ExtraFieldUtils.mergeLocalFileDataData | public static byte[] mergeLocalFileDataData(List<ZipExtraField> data) {
int regularExtraFieldCount = data.size();
int sum = WORD * regularExtraFieldCount;
for (ZipExtraField element : data) {
sum += element.getLocalFileDataLength().getValue();
}
byte[] result = new byte[sum];
int start =... | java | public static byte[] mergeLocalFileDataData(List<ZipExtraField> data) {
int regularExtraFieldCount = data.size();
int sum = WORD * regularExtraFieldCount;
for (ZipExtraField element : data) {
sum += element.getLocalFileDataLength().getValue();
}
byte[] result = new byte[sum];
int start =... | [
"public",
"static",
"byte",
"[",
"]",
"mergeLocalFileDataData",
"(",
"List",
"<",
"ZipExtraField",
">",
"data",
")",
"{",
"int",
"regularExtraFieldCount",
"=",
"data",
".",
"size",
"(",
")",
";",
"int",
"sum",
"=",
"WORD",
"*",
"regularExtraFieldCount",
";",... | Merges the local file data fields of the given ZipExtraFields.
@param data an array of ExtraFiles
@return an array of bytes
@since 1.1 | [
"Merges",
"the",
"local",
"file",
"data",
"fields",
"of",
"the",
"given",
"ZipExtraFields",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ExtraFieldUtils.java#L154-L174 |
115,623 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ZipLong.java | ZipLong.getBytes | public static byte[] getBytes(long value) {
byte[] result = new byte[WORD];
result[0] = (byte) ((value & BYTE_MASK));
result[BYTE_1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
result[BYTE_2] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT);
result[BYTE_3] = (byte) ((value & BYTE_3_MASK) >> BY... | java | public static byte[] getBytes(long value) {
byte[] result = new byte[WORD];
result[0] = (byte) ((value & BYTE_MASK));
result[BYTE_1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
result[BYTE_2] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT);
result[BYTE_3] = (byte) ((value & BYTE_3_MASK) >> BY... | [
"public",
"static",
"byte",
"[",
"]",
"getBytes",
"(",
"long",
"value",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"WORD",
"]",
";",
"result",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
"&",
"BYTE_MASK",
")",
"... | Get value as four bytes in big endian byte order.
@param value the value to convert
@return value as four bytes in big endian byte order | [
"Get",
"value",
"as",
"four",
"bytes",
"in",
"big",
"endian",
"byte",
"order",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ZipLong.java#L125-L132 |
115,624 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ZipLong.java | ZipLong.getValue | public static long getValue(byte[] bytes, int offset) {
long value = (bytes[offset + BYTE_3] << BYTE_3_SHIFT) & BYTE_3_MASK;
value += (bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;
value += (bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return ... | java | public static long getValue(byte[] bytes, int offset) {
long value = (bytes[offset + BYTE_3] << BYTE_3_SHIFT) & BYTE_3_MASK;
value += (bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;
value += (bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return ... | [
"public",
"static",
"long",
"getValue",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"long",
"value",
"=",
"(",
"bytes",
"[",
"offset",
"+",
"BYTE_3",
"]",
"<<",
"BYTE_3_SHIFT",
")",
"&",
"BYTE_3_MASK",
";",
"value",
"+=",
"(",
"by... | Helper method to get the value as a Java long from four bytes starting at given array offset
@param bytes the array of bytes
@param offset the offset to start
@return the corresponding Java long value | [
"Helper",
"method",
"to",
"get",
"the",
"value",
"as",
"a",
"Java",
"long",
"from",
"four",
"bytes",
"starting",
"at",
"given",
"array",
"offset"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ZipLong.java#L141-L147 |
115,625 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java | FileUtilsV2_2.forceDeleteOnExit | public static void forceDeleteOnExit(File file) throws IOException {
if (file.isDirectory()) {
deleteDirectoryOnExit(file);
} else {
file.deleteOnExit();
}
} | java | public static void forceDeleteOnExit(File file) throws IOException {
if (file.isDirectory()) {
deleteDirectoryOnExit(file);
} else {
file.deleteOnExit();
}
} | [
"public",
"static",
"void",
"forceDeleteOnExit",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"deleteDirectoryOnExit",
"(",
"file",
")",
";",
"}",
"else",
"{",
"file",
".",
"deleteOnExit... | Schedules a file to be deleted when JVM exits.
If file is directory delete it and all sub-directories.
@param file file or directory to delete, must not be <code>null</code>
@throws NullPointerException if the file is <code>null</code>
@throws IOException in case deletion is unsuccessful | [
"Schedules",
"a",
"file",
"to",
"be",
"deleted",
"when",
"JVM",
"exits",
".",
"If",
"file",
"is",
"directory",
"delete",
"it",
"and",
"all",
"sub",
"-",
"directories",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java#L806-L812 |
115,626 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java | FileUtilsV2_2.deleteDirectoryOnExit | private static void deleteDirectoryOnExit(File directory) throws IOException {
if (!directory.exists()) {
return;
}
directory.deleteOnExit();
if (!isSymlink(directory)) {
cleanDirectoryOnExit(directory);
}
} | java | private static void deleteDirectoryOnExit(File directory) throws IOException {
if (!directory.exists()) {
return;
}
directory.deleteOnExit();
if (!isSymlink(directory)) {
cleanDirectoryOnExit(directory);
}
} | [
"private",
"static",
"void",
"deleteDirectoryOnExit",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"directory",
".",
"deleteOnExit",
"(",
")",
";",
"if",
... | Schedules a directory recursively for deletion on JVM exit.
@param directory directory to delete, must not be <code>null</code>
@throws NullPointerException if the directory is <code>null</code>
@throws IOException in case deletion is unsuccessful | [
"Schedules",
"a",
"directory",
"recursively",
"for",
"deletion",
"on",
"JVM",
"exit",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java#L821-L830 |
115,627 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/commons/FileUtils.java | FileUtils.copy | public static void copy(File file, OutputStream out) throws IOException {
FileInputStream in = new FileInputStream(file);
try {
IOUtils.copy(new BufferedInputStream(in), out);
}
finally {
IOUtils.closeQuietly(in);
}
} | java | public static void copy(File file, OutputStream out) throws IOException {
FileInputStream in = new FileInputStream(file);
try {
IOUtils.copy(new BufferedInputStream(in), out);
}
finally {
IOUtils.closeQuietly(in);
}
} | [
"public",
"static",
"void",
"copy",
"(",
"File",
"file",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"try",
"{",
"IOUtils",
".",
"copy",
"(",
"new",
"Buffered... | Copies the given file into an output stream.
@param file input file (must exist).
@param out output stream.
@throws java.io.IOException if file is not found or copying fails | [
"Copies",
"the",
"given",
"file",
"into",
"an",
"output",
"stream",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtils.java#L33-L41 |
115,628 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/commons/FileUtils.java | FileUtils.getTempFileFor | public static File getTempFileFor(File file) {
File parent = file.getParentFile();
String name = file.getName();
File result;
int index = 0;
do {
result = new File(parent, name + "_" + index++);
}
while (result.exists());
return result;
} | java | public static File getTempFileFor(File file) {
File parent = file.getParentFile();
String name = file.getName();
File result;
int index = 0;
do {
result = new File(parent, name + "_" + index++);
}
while (result.exists());
return result;
} | [
"public",
"static",
"File",
"getTempFileFor",
"(",
"File",
"file",
")",
"{",
"File",
"parent",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"String",
"name",
"=",
"file",
".",
"getName",
"(",
")",
";",
"File",
"result",
";",
"int",
"index",
"=",
... | Find a non-existing file in the same directory using the same name as prefix.
@param file file used for the name and location (it is not read or written).
@return a non-existing file in the same directory using the same name as prefix. | [
"Find",
"a",
"non",
"-",
"existing",
"file",
"in",
"the",
"same",
"directory",
"using",
"the",
"same",
"name",
"as",
"prefix",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtils.java#L69-L79 |
115,629 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.addTransformer | public Zips addTransformer(String path, ZipEntryTransformer transformer) {
this.transformers.add(new ZipEntryTransformerEntry(path, transformer));
return this;
} | java | public Zips addTransformer(String path, ZipEntryTransformer transformer) {
this.transformers.add(new ZipEntryTransformerEntry(path, transformer));
return this;
} | [
"public",
"Zips",
"addTransformer",
"(",
"String",
"path",
",",
"ZipEntryTransformer",
"transformer",
")",
"{",
"this",
".",
"transformers",
".",
"add",
"(",
"new",
"ZipEntryTransformerEntry",
"(",
"path",
",",
"transformer",
")",
")",
";",
"return",
"this",
"... | Registers a transformer for a given entry.
@param path entry to transform
@param transformer transformer for the entry
@return this Zips for fluent api | [
"Registers",
"a",
"transformer",
"for",
"a",
"given",
"entry",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L336-L339 |
115,630 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.process | public void process() {
if (src == null && dest == null) {
throw new IllegalArgumentException("Source and destination shouldn't be null together");
}
File destinationFile = null;
try {
destinationFile = getDestinationFile();
ZipOutputStream out = null;
ZipEntryOrInfoAdapter zipE... | java | public void process() {
if (src == null && dest == null) {
throw new IllegalArgumentException("Source and destination shouldn't be null together");
}
File destinationFile = null;
try {
destinationFile = getDestinationFile();
ZipOutputStream out = null;
ZipEntryOrInfoAdapter zipE... | [
"public",
"void",
"process",
"(",
")",
"{",
"if",
"(",
"src",
"==",
"null",
"&&",
"dest",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Source and destination shouldn't be null together\"",
")",
";",
"}",
"File",
"destinationFile",
... | Iterates through source Zip entries removing or changing them according to
set parameters. | [
"Iterates",
"through",
"source",
"Zip",
"entries",
"removing",
"or",
"changing",
"them",
"according",
"to",
"set",
"parameters",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L345-L380 |
115,631 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.iterateExistingExceptRemoved | private void iterateExistingExceptRemoved(ZipEntryOrInfoAdapter zipEntryCallback) {
if (src == null) {
// if we don't have source specified, then we have nothing to iterate.
return;
}
final Set<String> removedDirs = ZipUtil.filterDirEntries(src, removedEntries);
ZipFile zf = null;
try {... | java | private void iterateExistingExceptRemoved(ZipEntryOrInfoAdapter zipEntryCallback) {
if (src == null) {
// if we don't have source specified, then we have nothing to iterate.
return;
}
final Set<String> removedDirs = ZipUtil.filterDirEntries(src, removedEntries);
ZipFile zf = null;
try {... | [
"private",
"void",
"iterateExistingExceptRemoved",
"(",
"ZipEntryOrInfoAdapter",
"zipEntryCallback",
")",
"{",
"if",
"(",
"src",
"==",
"null",
")",
"{",
"// if we don't have source specified, then we have nothing to iterate.",
"return",
";",
"}",
"final",
"Set",
"<",
"Str... | Iterate through source for not removed entries with a given callback
@param zipEntryCallback callback to execute on entries or their info. | [
"Iterate",
"through",
"source",
"for",
"not",
"removed",
"entries",
"with",
"a",
"given",
"callback"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L495-L545 |
115,632 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.iterateChangedAndAdded | private void iterateChangedAndAdded(ZipEntryOrInfoAdapter zipEntryCallback) {
for (ZipEntrySource entrySource : changedEntries) {
InputStream entrySourceStream = null;
try {
ZipEntry entry = entrySource.getEntry();
if (nameMapper != null) {
String mappedName = nameMapper.map(e... | java | private void iterateChangedAndAdded(ZipEntryOrInfoAdapter zipEntryCallback) {
for (ZipEntrySource entrySource : changedEntries) {
InputStream entrySourceStream = null;
try {
ZipEntry entry = entrySource.getEntry();
if (nameMapper != null) {
String mappedName = nameMapper.map(e... | [
"private",
"void",
"iterateChangedAndAdded",
"(",
"ZipEntryOrInfoAdapter",
"zipEntryCallback",
")",
"{",
"for",
"(",
"ZipEntrySource",
"entrySource",
":",
"changedEntries",
")",
"{",
"InputStream",
"entrySourceStream",
"=",
"null",
";",
"try",
"{",
"ZipEntry",
"entry"... | Iterate through ZipEntrySources for added or changed entries with a given callback
@param zipEntryCallback callback to execute on entries or their info | [
"Iterate",
"through",
"ZipEntrySources",
"for",
"added",
"or",
"changed",
"entries",
"with",
"a",
"given",
"callback"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L552-L581 |
115,633 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.handleInPlaceActions | private void handleInPlaceActions(File result) throws IOException {
if (isInPlace()) {
// we operate in-place
FileUtils.forceDelete(src);
if (result.isFile()) {
FileUtils.moveFile(result, src);
}
else {
FileUtils.moveDirectory(result, src);
}
}
} | java | private void handleInPlaceActions(File result) throws IOException {
if (isInPlace()) {
// we operate in-place
FileUtils.forceDelete(src);
if (result.isFile()) {
FileUtils.moveFile(result, src);
}
else {
FileUtils.moveDirectory(result, src);
}
}
} | [
"private",
"void",
"handleInPlaceActions",
"(",
"File",
"result",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isInPlace",
"(",
")",
")",
"{",
"// we operate in-place",
"FileUtils",
".",
"forceDelete",
"(",
"src",
")",
";",
"if",
"(",
"result",
".",
"isFil... | if we are doing something in place, move result file into src.
@param result destination zip file | [
"if",
"we",
"are",
"doing",
"something",
"in",
"place",
"move",
"result",
"file",
"into",
"src",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L588-L599 |
115,634 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.isEntryInDir | private boolean isEntryInDir(Set<String> dirNames, String entryName) {
// this should be done with a trie, put dirNames in a trie and check if entryName leads to
// some node or not.
for(String dirName : dirNames) {
if (entryName.startsWith(dirName)) {
return true;
}
}
return fal... | java | private boolean isEntryInDir(Set<String> dirNames, String entryName) {
// this should be done with a trie, put dirNames in a trie and check if entryName leads to
// some node or not.
for(String dirName : dirNames) {
if (entryName.startsWith(dirName)) {
return true;
}
}
return fal... | [
"private",
"boolean",
"isEntryInDir",
"(",
"Set",
"<",
"String",
">",
"dirNames",
",",
"String",
"entryName",
")",
"{",
"// this should be done with a trie, put dirNames in a trie and check if entryName leads to",
"// some node or not.",
"for",
"(",
"String",
"dirName",
":",
... | Checks if entry given by name resides inside of one of the dirs.
@param dirNames dirs
@param entryName entryPath | [
"Checks",
"if",
"entry",
"given",
"by",
"name",
"resides",
"inside",
"of",
"one",
"of",
"the",
"dirs",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L607-L616 |
115,635 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipFileUtil.java | ZipFileUtil.createZipInputStream | static ZipInputStream createZipInputStream(InputStream inStream, Charset charset) {
if (charset == null)
return new ZipInputStream(inStream);
try {
Constructor<ZipInputStream> constructor = ZipInputStream.class.getConstructor(new Class[] { InputStream.class, Charset.class });
return (ZipInput... | java | static ZipInputStream createZipInputStream(InputStream inStream, Charset charset) {
if (charset == null)
return new ZipInputStream(inStream);
try {
Constructor<ZipInputStream> constructor = ZipInputStream.class.getConstructor(new Class[] { InputStream.class, Charset.class });
return (ZipInput... | [
"static",
"ZipInputStream",
"createZipInputStream",
"(",
"InputStream",
"inStream",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"charset",
"==",
"null",
")",
"return",
"new",
"ZipInputStream",
"(",
"inStream",
")",
";",
"try",
"{",
"Constructor",
"<",
"Zip... | Returns a ZipInputStream opened with a given charset. | [
"Returns",
"a",
"ZipInputStream",
"opened",
"with",
"a",
"given",
"charset",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipFileUtil.java#L33-L56 |
115,636 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipFileUtil.java | ZipFileUtil.createZipOutputStream | static ZipOutputStream createZipOutputStream(BufferedOutputStream outStream, Charset charset) {
if (charset == null)
return new ZipOutputStream(outStream);
try {
Constructor<ZipOutputStream> constructor = ZipOutputStream.class.getConstructor(new Class[] { OutputStream.class, Charset.class });
... | java | static ZipOutputStream createZipOutputStream(BufferedOutputStream outStream, Charset charset) {
if (charset == null)
return new ZipOutputStream(outStream);
try {
Constructor<ZipOutputStream> constructor = ZipOutputStream.class.getConstructor(new Class[] { OutputStream.class, Charset.class });
... | [
"static",
"ZipOutputStream",
"createZipOutputStream",
"(",
"BufferedOutputStream",
"outStream",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"charset",
"==",
"null",
")",
"return",
"new",
"ZipOutputStream",
"(",
"outStream",
")",
";",
"try",
"{",
"Constructor",... | Returns a ZipOutputStream opened with a given charset. | [
"Returns",
"a",
"ZipOutputStream",
"opened",
"with",
"a",
"given",
"charset",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipFileUtil.java#L62-L85 |
115,637 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipFileUtil.java | ZipFileUtil.getZipFile | static ZipFile getZipFile(File src, Charset charset) throws IOException {
if (charset == null) {
return new ZipFile(src);
}
try {
Constructor<ZipFile> constructor = ZipFile.class.getConstructor(new Class[] { File.class, Charset.class });
return (ZipFile) constructor.newInstance(new Object... | java | static ZipFile getZipFile(File src, Charset charset) throws IOException {
if (charset == null) {
return new ZipFile(src);
}
try {
Constructor<ZipFile> constructor = ZipFile.class.getConstructor(new Class[] { File.class, Charset.class });
return (ZipFile) constructor.newInstance(new Object... | [
"static",
"ZipFile",
"getZipFile",
"(",
"File",
"src",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"charset",
"==",
"null",
")",
"{",
"return",
"new",
"ZipFile",
"(",
"src",
")",
";",
"}",
"try",
"{",
"Constructor",
"<",
"Z... | Returns a zipFile opened with a given charset | [
"Returns",
"a",
"zipFile",
"opened",
"with",
"a",
"given",
"charset"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipFileUtil.java#L90-L114 |
115,638 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ZipShort.java | ZipShort.getBytes | public byte[] getBytes() {
byte[] result = new byte[2];
result[0] = (byte) (value & BYTE_MASK);
result[1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
return result;
} | java | public byte[] getBytes() {
byte[] result = new byte[2];
result[0] = (byte) (value & BYTE_MASK);
result[1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
return result;
} | [
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"result",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
"&",
"BYTE_MASK",
")",
";",
"result",
"[",
"1",
"]",
"=",... | Get value as two bytes in big endian byte order.
@return the value as a a two byte array in big endian byte order
@since 1.1 | [
"Get",
"value",
"as",
"two",
"bytes",
"in",
"big",
"endian",
"byte",
"order",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ZipShort.java#L75-L80 |
115,639 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/ZipShort.java | ZipShort.getValue | public static int getValue(byte[] bytes, int offset) {
int value = (bytes[offset + 1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return value;
} | java | public static int getValue(byte[] bytes, int offset) {
int value = (bytes[offset + 1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return value;
} | [
"public",
"static",
"int",
"getValue",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"int",
"value",
"=",
"(",
"bytes",
"[",
"offset",
"+",
"1",
"]",
"<<",
"BYTE_1_SHIFT",
")",
"&",
"BYTE_1_MASK",
";",
"value",
"+=",
"(",
"bytes",
... | Helper method to get the value as a java int from two bytes starting at given array offset
@param bytes the array of bytes
@param offset the offset to start
@return the corresponding java int value | [
"Helper",
"method",
"to",
"get",
"the",
"value",
"as",
"a",
"java",
"int",
"from",
"two",
"bytes",
"starting",
"at",
"given",
"array",
"offset"
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/ZipShort.java#L112-L116 |
115,640 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/UnrecognizedExtraField.java | UnrecognizedExtraField.copy | private static byte[] copy(byte[] from) {
if (from != null) {
byte[] to = new byte[from.length];
System.arraycopy(from, 0, to, 0, to.length);
return to;
}
return null;
} | java | private static byte[] copy(byte[] from) {
if (from != null) {
byte[] to = new byte[from.length];
System.arraycopy(from, 0, to, 0, to.length);
return to;
}
return null;
} | [
"private",
"static",
"byte",
"[",
"]",
"copy",
"(",
"byte",
"[",
"]",
"from",
")",
"{",
"if",
"(",
"from",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"to",
"=",
"new",
"byte",
"[",
"from",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"("... | Create a copy of the given array - or return null if the
argument is null. | [
"Create",
"a",
"copy",
"of",
"the",
"given",
"array",
"-",
"or",
"return",
"null",
"if",
"the",
"argument",
"is",
"null",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/UnrecognizedExtraField.java#L170-L177 |
115,641 | zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/transform/StreamZipEntryTransformer.java | StreamZipEntryTransformer.transform | public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out) throws IOException {
ZipEntry entry = new ZipEntry(zipEntry.getName());
entry.setTime(System.currentTimeMillis());
out.putNextEntry(entry);
transform(zipEntry, in, out);
out.closeEntry();
} | java | public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out) throws IOException {
ZipEntry entry = new ZipEntry(zipEntry.getName());
entry.setTime(System.currentTimeMillis());
out.putNextEntry(entry);
transform(zipEntry, in, out);
out.closeEntry();
} | [
"public",
"void",
"transform",
"(",
"InputStream",
"in",
",",
"ZipEntry",
"zipEntry",
",",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"ZipEntry",
"entry",
"=",
"new",
"ZipEntry",
"(",
"zipEntry",
".",
"getName",
"(",
")",
")",
";",
"entry",... | Transforms the input stream entry, writes that to output stream, closes entry in the output stream.
@param in input stream of the entry contents
@param zipEntry zip entry metadata
@param out output stream to write transformed entry (if necessary)
@throws IOException if anything goes wrong | [
"Transforms",
"the",
"input",
"stream",
"entry",
"writes",
"that",
"to",
"output",
"stream",
"closes",
"entry",
"in",
"the",
"output",
"stream",
"."
] | abb4dc43583e4d19339c0c021035019798970a13 | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/transform/StreamZipEntryTransformer.java#L36-L42 |
115,642 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.node | public JsonAssert node(String node) {
return new JsonAssert(path.to(node), configuration, getNode(actual, node));
} | java | public JsonAssert node(String node) {
return new JsonAssert(path.to(node), configuration, getNode(actual, node));
} | [
"public",
"JsonAssert",
"node",
"(",
"String",
"node",
")",
"{",
"return",
"new",
"JsonAssert",
"(",
"path",
".",
"to",
"(",
"node",
")",
",",
"configuration",
",",
"getNode",
"(",
"actual",
",",
"node",
")",
")",
";",
"}"
] | Moves comparison to given node. Second call navigates from the last position in the JSON. | [
"Moves",
"comparison",
"to",
"given",
"node",
".",
"Second",
"call",
"navigates",
"from",
"the",
"last",
"position",
"in",
"the",
"JSON",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L75-L77 |
115,643 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.and | public JsonAssert and(JsonAssertion... assertions) {
Arrays.stream(assertions).forEach(a -> a.doAssert(this));
return this;
} | java | public JsonAssert and(JsonAssertion... assertions) {
Arrays.stream(assertions).forEach(a -> a.doAssert(this));
return this;
} | [
"public",
"JsonAssert",
"and",
"(",
"JsonAssertion",
"...",
"assertions",
")",
"{",
"Arrays",
".",
"stream",
"(",
"assertions",
")",
".",
"forEach",
"(",
"a",
"->",
"a",
".",
"doAssert",
"(",
"this",
")",
")",
";",
"return",
"this",
";",
"}"
] | Allows to do multiple comparisons on a document like
<code>
assertThatJson("{\"test\":{\"a\":1, \"b\":2, \"c\":3}}").and(
a -> a.node("test").isObject(),
a -> a.node("test.b").isEqualTo(3)
);
</code> | [
"Allows",
"to",
"do",
"multiple",
"comparisons",
"on",
"a",
"document",
"like"
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L90-L93 |
115,644 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.isEqualTo | @Override
public JsonAssert isEqualTo(Object expected) {
Diff diff = Diff.create(expected, actual, "fullJson", path.asPrefix(), configuration);
String overridingErrorMessage = info.overridingErrorMessage();
if (!isNullOrEmpty(overridingErrorMessage) && !diff.similar()) {
failWit... | java | @Override
public JsonAssert isEqualTo(Object expected) {
Diff diff = Diff.create(expected, actual, "fullJson", path.asPrefix(), configuration);
String overridingErrorMessage = info.overridingErrorMessage();
if (!isNullOrEmpty(overridingErrorMessage) && !diff.similar()) {
failWit... | [
"@",
"Override",
"public",
"JsonAssert",
"isEqualTo",
"(",
"Object",
"expected",
")",
"{",
"Diff",
"diff",
"=",
"Diff",
".",
"create",
"(",
"expected",
",",
"actual",
",",
"\"fullJson\"",
",",
"path",
".",
"asPrefix",
"(",
")",
",",
"configuration",
")",
... | Compares JSONs. | [
"Compares",
"JSONs",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L98-L109 |
115,645 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.failWithMessage | private void failWithMessage(String errorMessage) {
AssertionError assertionError = Failures.instance().failureIfErrorMessageIsOverridden(info);
if (assertionError == null) {
// error message was not overridden, build it.
String description = MessageFormatter.instance().format(info.descripti... | java | private void failWithMessage(String errorMessage) {
AssertionError assertionError = Failures.instance().failureIfErrorMessageIsOverridden(info);
if (assertionError == null) {
// error message was not overridden, build it.
String description = MessageFormatter.instance().format(info.descripti... | [
"private",
"void",
"failWithMessage",
"(",
"String",
"errorMessage",
")",
"{",
"AssertionError",
"assertionError",
"=",
"Failures",
".",
"instance",
"(",
")",
".",
"failureIfErrorMessageIsOverridden",
"(",
"info",
")",
";",
"if",
"(",
"assertionError",
"==",
"null... | Copy from AssertJ to prevent errors with percents in error message | [
"Copy",
"from",
"AssertJ",
"to",
"prevent",
"errors",
"with",
"percents",
"in",
"error",
"message"
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L114-L123 |
115,646 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.isObject | public MapAssert<String, Object> isObject() {
Node node = assertType(OBJECT);
return new JsonMapAssert((Map<String, Object>) node.getValue(), path.asPrefix(), configuration)
.as("Different value found in node \"%s\"", path);
} | java | public MapAssert<String, Object> isObject() {
Node node = assertType(OBJECT);
return new JsonMapAssert((Map<String, Object>) node.getValue(), path.asPrefix(), configuration)
.as("Different value found in node \"%s\"", path);
} | [
"public",
"MapAssert",
"<",
"String",
",",
"Object",
">",
"isObject",
"(",
")",
"{",
"Node",
"node",
"=",
"assertType",
"(",
"OBJECT",
")",
";",
"return",
"new",
"JsonMapAssert",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"node",
".",
"... | Asserts that given node is present and is of type object.
@return MapAssert where the object is serialized as Map | [
"Asserts",
"that",
"given",
"node",
"is",
"present",
"and",
"is",
"of",
"type",
"object",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L130-L134 |
115,647 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.asNumber | public BigDecimalAssert asNumber() {
isPresent(NUMBER.getDescription());
Node node = getNode(actual, "");
if (node.getNodeType() == NUMBER) {
return createBigDecimalAssert(node.decimalValue());
} else if (node.getNodeType() == STRING) {
try {
retur... | java | public BigDecimalAssert asNumber() {
isPresent(NUMBER.getDescription());
Node node = getNode(actual, "");
if (node.getNodeType() == NUMBER) {
return createBigDecimalAssert(node.decimalValue());
} else if (node.getNodeType() == STRING) {
try {
retur... | [
"public",
"BigDecimalAssert",
"asNumber",
"(",
")",
"{",
"isPresent",
"(",
"NUMBER",
".",
"getDescription",
"(",
")",
")",
";",
"Node",
"node",
"=",
"getNode",
"(",
"actual",
",",
"\"\"",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",... | Asserts that given node is present and is of type number or a string that can be parsed as a number. | [
"Asserts",
"that",
"given",
"node",
"is",
"present",
"and",
"is",
"of",
"type",
"number",
"or",
"a",
"string",
"that",
"can",
"be",
"parsed",
"as",
"a",
"number",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L149-L164 |
115,648 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.isArray | public ListAssert<Object> isArray() {
Node node = assertType(ARRAY);
return new JsonListAssert((List<?>)node.getValue(), path.asPrefix(), configuration)
.as("Different value found in node \"%s\"", path);
} | java | public ListAssert<Object> isArray() {
Node node = assertType(ARRAY);
return new JsonListAssert((List<?>)node.getValue(), path.asPrefix(), configuration)
.as("Different value found in node \"%s\"", path);
} | [
"public",
"ListAssert",
"<",
"Object",
">",
"isArray",
"(",
")",
"{",
"Node",
"node",
"=",
"assertType",
"(",
"ARRAY",
")",
";",
"return",
"new",
"JsonListAssert",
"(",
"(",
"List",
"<",
"?",
">",
")",
"node",
".",
"getValue",
"(",
")",
",",
"path",
... | Asserts that given node is present and is of type array.
@return | [
"Asserts",
"that",
"given",
"node",
"is",
"present",
"and",
"is",
"of",
"type",
"array",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L175-L179 |
115,649 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.isBoolean | public BooleanAssert isBoolean() {
Node node = assertType(BOOLEAN);
return new BooleanAssert((Boolean) node.getValue()).as("Different value found in node \"%s\"", path);
} | java | public BooleanAssert isBoolean() {
Node node = assertType(BOOLEAN);
return new BooleanAssert((Boolean) node.getValue()).as("Different value found in node \"%s\"", path);
} | [
"public",
"BooleanAssert",
"isBoolean",
"(",
")",
"{",
"Node",
"node",
"=",
"assertType",
"(",
"BOOLEAN",
")",
";",
"return",
"new",
"BooleanAssert",
"(",
"(",
"Boolean",
")",
"node",
".",
"getValue",
"(",
")",
")",
".",
"as",
"(",
"\"Different value found... | Asserts that given node is present and is of type boolean.
@return | [
"Asserts",
"that",
"given",
"node",
"is",
"present",
"and",
"is",
"of",
"type",
"boolean",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L186-L189 |
115,650 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.isString | public StringAssert isString() {
Node node = assertType(STRING);
return new StringAssert((String) node.getValue()).as("Different value found in node \"%s\"", path);
} | java | public StringAssert isString() {
Node node = assertType(STRING);
return new StringAssert((String) node.getValue()).as("Different value found in node \"%s\"", path);
} | [
"public",
"StringAssert",
"isString",
"(",
")",
"{",
"Node",
"node",
"=",
"assertType",
"(",
"STRING",
")",
";",
"return",
"new",
"StringAssert",
"(",
"(",
"String",
")",
"node",
".",
"getValue",
"(",
")",
")",
".",
"as",
"(",
"\"Different value found in n... | Asserts that given node is present and is of type string.
@return | [
"Asserts",
"that",
"given",
"node",
"is",
"present",
"and",
"is",
"of",
"type",
"string",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L196-L199 |
115,651 | lukas-krecan/JsonUnit | json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java | JsonAssert.isNotNull | @Override
public JsonAssert isNotNull() {
isPresent("not null");
Node node = getNode(actual, "");
if (node.getNodeType() == NULL) {
failOnType(node, "not null");
}
return this;
} | java | @Override
public JsonAssert isNotNull() {
isPresent("not null");
Node node = getNode(actual, "");
if (node.getNodeType() == NULL) {
failOnType(node, "not null");
}
return this;
} | [
"@",
"Override",
"public",
"JsonAssert",
"isNotNull",
"(",
")",
"{",
"isPresent",
"(",
"\"not null\"",
")",
";",
"Node",
"node",
"=",
"getNode",
"(",
"actual",
",",
"\"\"",
")",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"NULL",
")",
... | Asserts that given node is present and is not null.
@return | [
"Asserts",
"that",
"given",
"node",
"is",
"present",
"and",
"is",
"not",
"null",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-assertj/src/main/java/net/javacrumbs/jsonunit/assertj/JsonAssert.java#L240-L248 |
115,652 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Path.java | Path.toField | Path toField(String name) {
if (isRoot()) {
return copy(name);
} else {
return copy(path + "." + name);
}
} | java | Path toField(String name) {
if (isRoot()) {
return copy(name);
} else {
return copy(path + "." + name);
}
} | [
"Path",
"toField",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"isRoot",
"(",
")",
")",
"{",
"return",
"copy",
"(",
"name",
")",
";",
"}",
"else",
"{",
"return",
"copy",
"(",
"path",
"+",
"\".\"",
"+",
"name",
")",
";",
"}",
"}"
] | Construct path to a filed. | [
"Construct",
"path",
"to",
"a",
"filed",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Path.java#L72-L78 |
115,653 | lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonMatchers.java | JsonMatchers.jsonPartEquals | public static <T> ConfigurableJsonMatcher<T> jsonPartEquals(String path, Object expected) {
return new JsonPartMatcher<>(path, expected);
} | java | public static <T> ConfigurableJsonMatcher<T> jsonPartEquals(String path, Object expected) {
return new JsonPartMatcher<>(path, expected);
} | [
"public",
"static",
"<",
"T",
">",
"ConfigurableJsonMatcher",
"<",
"T",
">",
"jsonPartEquals",
"(",
"String",
"path",
",",
"Object",
"expected",
")",
"{",
"return",
"new",
"JsonPartMatcher",
"<>",
"(",
"path",
",",
"expected",
")",
";",
"}"
] | Is the part of the JSON equivalent? | [
"Is",
"the",
"part",
"of",
"the",
"JSON",
"equivalent?"
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonMatchers.java#L63-L65 |
115,654 | lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonMatchers.java | JsonMatchers.jsonPartMatches | public static <T> Matcher<T> jsonPartMatches(String path, Matcher<?> matcher) {
return new MatcherApplyingMatcher<>(path, matcher);
} | java | public static <T> Matcher<T> jsonPartMatches(String path, Matcher<?> matcher) {
return new MatcherApplyingMatcher<>(path, matcher);
} | [
"public",
"static",
"<",
"T",
">",
"Matcher",
"<",
"T",
">",
"jsonPartMatches",
"(",
"String",
"path",
",",
"Matcher",
"<",
"?",
">",
"matcher",
")",
"{",
"return",
"new",
"MatcherApplyingMatcher",
"<>",
"(",
"path",
",",
"matcher",
")",
";",
"}"
] | Applies matcher to the part of the JSON. | [
"Applies",
"matcher",
"to",
"the",
"part",
"of",
"the",
"JSON",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonMatchers.java#L70-L72 |
115,655 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ClassUtils.java | ClassUtils.isClassPresent | static boolean isClassPresent(String className) {
try {
ClassUtils.class.getClassLoader().loadClass(className);
return true;
} catch (Throwable e) {
return false;
}
} | java | static boolean isClassPresent(String className) {
try {
ClassUtils.class.getClassLoader().loadClass(className);
return true;
} catch (Throwable e) {
return false;
}
} | [
"static",
"boolean",
"isClassPresent",
"(",
"String",
"className",
")",
"{",
"try",
"{",
"ClassUtils",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"loadClass",
"(",
"className",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Throwable",
"e",
... | Checks if given class is present.
@param className
@return | [
"Checks",
"if",
"given",
"class",
"is",
"present",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ClassUtils.java#L25-L32 |
115,656 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java | Configuration.withTolerance | public Configuration withTolerance(BigDecimal tolerance) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | java | public Configuration withTolerance(BigDecimal tolerance) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | [
"public",
"Configuration",
"withTolerance",
"(",
"BigDecimal",
"tolerance",
")",
"{",
"return",
"new",
"Configuration",
"(",
"tolerance",
",",
"options",
",",
"ignorePlaceholder",
",",
"matchers",
",",
"pathsToBeIgnored",
",",
"differenceListener",
")",
";",
"}"
] | Sets numerical comparison tolerance.
@param tolerance
@return | [
"Sets",
"numerical",
"comparison",
"tolerance",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java#L75-L77 |
115,657 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java | Configuration.withOptions | public Configuration withOptions(Option first, Option... next) {
return new Configuration(tolerance, options.with(first, next), ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | java | public Configuration withOptions(Option first, Option... next) {
return new Configuration(tolerance, options.with(first, next), ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | [
"public",
"Configuration",
"withOptions",
"(",
"Option",
"first",
",",
"Option",
"...",
"next",
")",
"{",
"return",
"new",
"Configuration",
"(",
"tolerance",
",",
"options",
".",
"with",
"(",
"first",
",",
"next",
")",
",",
"ignorePlaceholder",
",",
"matcher... | Adds comparison options.
@param first
@param next
@return | [
"Adds",
"comparison",
"options",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java#L107-L109 |
115,658 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java | Configuration.withOptions | public Configuration withOptions(Options options) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | java | public Configuration withOptions(Options options) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | [
"public",
"Configuration",
"withOptions",
"(",
"Options",
"options",
")",
"{",
"return",
"new",
"Configuration",
"(",
"tolerance",
",",
"options",
",",
"ignorePlaceholder",
",",
"matchers",
",",
"pathsToBeIgnored",
",",
"differenceListener",
")",
";",
"}"
] | Sets comparison options.
@param options
@return | [
"Sets",
"comparison",
"options",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java#L117-L119 |
115,659 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java | Configuration.withIgnorePlaceholder | public Configuration withIgnorePlaceholder(String ignorePlaceholder) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | java | public Configuration withIgnorePlaceholder(String ignorePlaceholder) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | [
"public",
"Configuration",
"withIgnorePlaceholder",
"(",
"String",
"ignorePlaceholder",
")",
"{",
"return",
"new",
"Configuration",
"(",
"tolerance",
",",
"options",
",",
"ignorePlaceholder",
",",
"matchers",
",",
"pathsToBeIgnored",
",",
"differenceListener",
")",
";... | Sets ignore placeholder.
@param ignorePlaceholder
@return | [
"Sets",
"ignore",
"placeholder",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java#L131-L133 |
115,660 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java | Configuration.withDifferenceListener | public Configuration withDifferenceListener(DifferenceListener differenceListener) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | java | public Configuration withDifferenceListener(DifferenceListener differenceListener) {
return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
} | [
"public",
"Configuration",
"withDifferenceListener",
"(",
"DifferenceListener",
"differenceListener",
")",
"{",
"return",
"new",
"Configuration",
"(",
"tolerance",
",",
"options",
",",
"ignorePlaceholder",
",",
"matchers",
",",
"pathsToBeIgnored",
",",
"differenceListener... | Sets difference listener | [
"Sets",
"difference",
"listener"
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/Configuration.java#L149-L151 |
115,661 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/util/ResourceUtils.java | ResourceUtils.resource | public static Reader resource(String resourceName) {
if (resourceName == null) {
throw new NullPointerException("'null' passed instead of resource name");
}
final InputStream resourceStream = ClassLoader.getSystemResourceAsStream(resourceName);
if (resourceStream == null) {
... | java | public static Reader resource(String resourceName) {
if (resourceName == null) {
throw new NullPointerException("'null' passed instead of resource name");
}
final InputStream resourceStream = ClassLoader.getSystemResourceAsStream(resourceName);
if (resourceStream == null) {
... | [
"public",
"static",
"Reader",
"resource",
"(",
"String",
"resourceName",
")",
"{",
"if",
"(",
"resourceName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"'null' passed instead of resource name\"",
")",
";",
"}",
"final",
"InputStream",
... | Helper method to read a classpath resource. | [
"Helper",
"method",
"to",
"read",
"a",
"classpath",
"resource",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/util/ResourceUtils.java#L34-L45 |
115,662 | lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isPresent | public ResultMatcher isPresent() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
}
};
} | java | public ResultMatcher isPresent() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
}
};
} | [
"public",
"ResultMatcher",
"isPresent",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isPresent",
"(",
"actual",
")",
";",
"}",
"}",
";... | Fails if the node is missing. | [
"Fails",
"if",
"the",
"node",
"is",
"missing",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L155-L161 |
115,663 | lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isArray | public ResultMatcher isArray() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != ARRAY) {
failOnType(node, "an ar... | java | public ResultMatcher isArray() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != ARRAY) {
failOnType(node, "an ar... | [
"public",
"ResultMatcher",
"isArray",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isPresent",
"(",
"actual",
")",
";",
"Node",
"node",
... | Fails if the selected JSON is not an Array or is not present.
@return | [
"Fails",
"if",
"the",
"selected",
"JSON",
"is",
"not",
"an",
"Array",
"or",
"is",
"not",
"present",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L168-L178 |
115,664 | lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isObject | public ResultMatcher isObject() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != OBJECT) {
failOnType(node, "an ... | java | public ResultMatcher isObject() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != OBJECT) {
failOnType(node, "an ... | [
"public",
"ResultMatcher",
"isObject",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isPresent",
"(",
"actual",
")",
";",
"Node",
"node",... | Fails if the selected JSON is not an Object or is not present. | [
"Fails",
"if",
"the",
"selected",
"JSON",
"is",
"not",
"an",
"Object",
"or",
"is",
"not",
"present",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L183-L193 |
115,665 | lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isString | public ResultMatcher isString() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isString(actual);
}
};
} | java | public ResultMatcher isString() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isString(actual);
}
};
} | [
"public",
"ResultMatcher",
"isString",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isString",
"(",
"actual",
")",
";",
"}",
"}",
";",... | Fails if the selected JSON is not a String or is not present. | [
"Fails",
"if",
"the",
"selected",
"JSON",
"is",
"not",
"a",
"String",
"or",
"is",
"not",
"present",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L198-L204 |
115,666 | lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isNull | public ResultMatcher isNull() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isNull(actual);
}
};
} | java | public ResultMatcher isNull() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isNull(actual);
}
};
} | [
"public",
"ResultMatcher",
"isNull",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isNull",
"(",
"actual",
")",
";",
"}",
"}",
";",
"... | Fails if selected JSON is not null. | [
"Fails",
"if",
"selected",
"JSON",
"is",
"not",
"null",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L209-L215 |
115,667 | lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isNotNull | public ResultMatcher isNotNull() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isNotNull(actual);
}
};
} | java | public ResultMatcher isNotNull() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isNotNull(actual);
}
};
} | [
"public",
"ResultMatcher",
"isNotNull",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isNotNull",
"(",
"actual",
")",
";",
"}",
"}",
";... | Fails if selected JSON is null. | [
"Fails",
"if",
"selected",
"JSON",
"is",
"null",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L220-L226 |
115,668 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java | JsonUtils.valueToNode | public static Node valueToNode(Object source) {
if (source instanceof Node) {
return (Node) source;
} else {
return converter.valueToNode(source);
}
} | java | public static Node valueToNode(Object source) {
if (source instanceof Node) {
return (Node) source;
} else {
return converter.valueToNode(source);
}
} | [
"public",
"static",
"Node",
"valueToNode",
"(",
"Object",
"source",
")",
"{",
"if",
"(",
"source",
"instanceof",
"Node",
")",
"{",
"return",
"(",
"Node",
")",
"source",
";",
"}",
"else",
"{",
"return",
"converter",
".",
"valueToNode",
"(",
"source",
")",... | Converts value to Json node. It can be Map, String, null, or primitive. Should not be parsed, just converted.
@param source
@return | [
"Converts",
"value",
"to",
"Json",
"node",
".",
"It",
"can",
"be",
"Map",
"String",
"null",
"or",
"primitive",
".",
"Should",
"not",
"be",
"parsed",
"just",
"converted",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java#L66-L72 |
115,669 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java | JsonUtils.nodeExists | @Deprecated
public static boolean nodeExists(Object json, String path) {
return !getNode(json, path).isMissingNode();
} | java | @Deprecated
public static boolean nodeExists(Object json, String path) {
return !getNode(json, path).isMissingNode();
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"nodeExists",
"(",
"Object",
"json",
",",
"String",
"path",
")",
"{",
"return",
"!",
"getNode",
"(",
"json",
",",
"path",
")",
".",
"isMissingNode",
"(",
")",
";",
"}"
] | Returns true if the node exists. | [
"Returns",
"true",
"if",
"the",
"node",
"exists",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java#L99-L102 |
115,670 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java | JsonUtils.nodeAbsent | static boolean nodeAbsent(Object json, Path path, boolean treatNullAsAbsent) {
Node node = getNode(json, path);
if (node.isNull()) {
return treatNullAsAbsent;
} else {
return node.isMissingNode();
}
} | java | static boolean nodeAbsent(Object json, Path path, boolean treatNullAsAbsent) {
Node node = getNode(json, path);
if (node.isNull()) {
return treatNullAsAbsent;
} else {
return node.isMissingNode();
}
} | [
"static",
"boolean",
"nodeAbsent",
"(",
"Object",
"json",
",",
"Path",
"path",
",",
"boolean",
"treatNullAsAbsent",
")",
"{",
"Node",
"node",
"=",
"getNode",
"(",
"json",
",",
"path",
")",
";",
"if",
"(",
"node",
".",
"isNull",
"(",
")",
")",
"{",
"r... | Returns true if the is absent. | [
"Returns",
"true",
"if",
"the",
"is",
"absent",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java#L137-L144 |
115,671 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ComparisonMatrix.java | ComparisonMatrix.getEqualToUsedOnlyInEquivalentElements | private List<Integer> getEqualToUsedOnlyInEquivalentElements(List<Integer> equalTo, List<Integer> equivalentElements) {
List<Integer> result = new ArrayList<>(equalTo);
for (int i = 0; i < equalElements.size(); i++) {
if (!alreadyMatched.get(i)) {
if (!equivalentElements.cont... | java | private List<Integer> getEqualToUsedOnlyInEquivalentElements(List<Integer> equalTo, List<Integer> equivalentElements) {
List<Integer> result = new ArrayList<>(equalTo);
for (int i = 0; i < equalElements.size(); i++) {
if (!alreadyMatched.get(i)) {
if (!equivalentElements.cont... | [
"private",
"List",
"<",
"Integer",
">",
"getEqualToUsedOnlyInEquivalentElements",
"(",
"List",
"<",
"Integer",
">",
"equalTo",
",",
"List",
"<",
"Integer",
">",
"equivalentElements",
")",
"{",
"List",
"<",
"Integer",
">",
"result",
"=",
"new",
"ArrayList",
"<>... | If there are more equivalent elements, we can match those that are not used anywhere else
we iterate over actual elements that are not in equivalentElements and from equalTo remove those
that are used outside equivalent elements | [
"If",
"there",
"are",
"more",
"equivalent",
"elements",
"we",
"can",
"match",
"those",
"that",
"are",
"not",
"used",
"anywhere",
"else",
"we",
"iterate",
"over",
"actual",
"elements",
"that",
"are",
"not",
"in",
"equivalentElements",
"and",
"from",
"equalTo",
... | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/ComparisonMatrix.java#L141-L151 |
115,672 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java | Diff.compareObjectNodes | private void compareObjectNodes(Context context) {
Node expected = context.getExpectedNode();
Node actual = context.getActualNode();
Path path = context.getActualPath();
Map<String, Node> expectedFields = getFields(expected);
Map<String, Node> actualFields = getFields(actual);
... | java | private void compareObjectNodes(Context context) {
Node expected = context.getExpectedNode();
Node actual = context.getActualNode();
Path path = context.getActualPath();
Map<String, Node> expectedFields = getFields(expected);
Map<String, Node> actualFields = getFields(actual);
... | [
"private",
"void",
"compareObjectNodes",
"(",
"Context",
"context",
")",
"{",
"Node",
"expected",
"=",
"context",
".",
"getExpectedNode",
"(",
")",
";",
"Node",
"actual",
"=",
"context",
".",
"getActualNode",
"(",
")",
";",
"Path",
"path",
"=",
"context",
... | Compares object nodes. | [
"Compares",
"object",
"nodes",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java#L134-L173 |
115,673 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java | Diff.getNotNullExtraKeys | private Set<String> getNotNullExtraKeys(Node actual, Set<String> extraKeys) {
Set<String> notNullExtraKeys = new TreeSet<>();
for (String extraKey : extraKeys) {
if (!actual.get(extraKey).isNull()) {
notNullExtraKeys.add(extraKey);
}
}
return notNu... | java | private Set<String> getNotNullExtraKeys(Node actual, Set<String> extraKeys) {
Set<String> notNullExtraKeys = new TreeSet<>();
for (String extraKey : extraKeys) {
if (!actual.get(extraKey).isNull()) {
notNullExtraKeys.add(extraKey);
}
}
return notNu... | [
"private",
"Set",
"<",
"String",
">",
"getNotNullExtraKeys",
"(",
"Node",
"actual",
",",
"Set",
"<",
"String",
">",
"extraKeys",
")",
"{",
"Set",
"<",
"String",
">",
"notNullExtraKeys",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"for",
"(",
"String",
... | Returns extra keys that are not null. | [
"Returns",
"extra",
"keys",
"that",
"are",
"not",
"null",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java#L199-L207 |
115,674 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java | Diff.compareNodes | private void compareNodes(Context context) {
if (shouldIgnorePath(context.getActualPath())) {
return;
}
Node expectedNode = context.getExpectedNode();
Node actualNode = context.getActualNode();
NodeType expectedNodeType = expectedNode.getNodeType();
NodeType... | java | private void compareNodes(Context context) {
if (shouldIgnorePath(context.getActualPath())) {
return;
}
Node expectedNode = context.getExpectedNode();
Node actualNode = context.getActualNode();
NodeType expectedNodeType = expectedNode.getNodeType();
NodeType... | [
"private",
"void",
"compareNodes",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"shouldIgnorePath",
"(",
"context",
".",
"getActualPath",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"Node",
"expectedNode",
"=",
"context",
".",
"getExpectedNode",
"(",
"... | Compares two nodes. | [
"Compares",
"two",
"nodes",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java#L262-L339 |
115,675 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java | Diff.getFields | private static Map<String, Node> getFields(Node node) {
Map<String, Node> result = new HashMap<>();
Iterator<KeyValue> fields = node.fields();
while (fields.hasNext()) {
KeyValue field = fields.next();
result.put(field.getKey(), field.getValue());
}
return... | java | private static Map<String, Node> getFields(Node node) {
Map<String, Node> result = new HashMap<>();
Iterator<KeyValue> fields = node.fields();
while (fields.hasNext()) {
KeyValue field = fields.next();
result.put(field.getKey(), field.getValue());
}
return... | [
"private",
"static",
"Map",
"<",
"String",
",",
"Node",
">",
"getFields",
"(",
"Node",
"node",
")",
"{",
"Map",
"<",
"String",
",",
"Node",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Iterator",
"<",
"KeyValue",
">",
"fields",
"=",
... | Returns children of an ObjectNode.
@param node
@return | [
"Returns",
"children",
"of",
"an",
"ObjectNode",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Diff.java#L579-L587 |
115,676 | lukas-krecan/JsonUnit | json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Converter.java | Converter.createDefaultConverter | static Converter createDefaultConverter() {
List<NodeFactory> factories;
String property = System.getProperty(LIBRARIES_PROPERTY_NAME);
if (property != null && property.trim().length() > 0) {
factories = createFactoriesSpecifiedInProperty(property);
} else {
fact... | java | static Converter createDefaultConverter() {
List<NodeFactory> factories;
String property = System.getProperty(LIBRARIES_PROPERTY_NAME);
if (property != null && property.trim().length() > 0) {
factories = createFactoriesSpecifiedInProperty(property);
} else {
fact... | [
"static",
"Converter",
"createDefaultConverter",
"(",
")",
"{",
"List",
"<",
"NodeFactory",
">",
"factories",
";",
"String",
"property",
"=",
"System",
".",
"getProperty",
"(",
"LIBRARIES_PROPERTY_NAME",
")",
";",
"if",
"(",
"property",
"!=",
"null",
"&&",
"pr... | Creates converter based on the libraries on the classpath. | [
"Creates",
"converter",
"based",
"on",
"the",
"libraries",
"on",
"the",
"classpath",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/Converter.java#L54-L68 |
115,677 | lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonNotEquals | public static void assertJsonNotEquals(Object expected, Object fullJson, Configuration configuration) {
assertJsonPartNotEquals(expected, fullJson, ROOT, configuration);
} | java | public static void assertJsonNotEquals(Object expected, Object fullJson, Configuration configuration) {
assertJsonPartNotEquals(expected, fullJson, ROOT, configuration);
} | [
"public",
"static",
"void",
"assertJsonNotEquals",
"(",
"Object",
"expected",
",",
"Object",
"fullJson",
",",
"Configuration",
"configuration",
")",
"{",
"assertJsonPartNotEquals",
"(",
"expected",
",",
"fullJson",
",",
"ROOT",
",",
"configuration",
")",
";",
"}"
... | Compares JSONs and fails if they are equal. | [
"Compares",
"JSONs",
"and",
"fails",
"if",
"they",
"are",
"equal",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L95-L97 |
115,678 | lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonNodeAbsent | public static void assertJsonNodeAbsent(Object actual, String path) {
if (!nodeAbsent(actual, path, configuration)) {
doFail("Node \"" + path + "\" is present.");
}
} | java | public static void assertJsonNodeAbsent(Object actual, String path) {
if (!nodeAbsent(actual, path, configuration)) {
doFail("Node \"" + path + "\" is present.");
}
} | [
"public",
"static",
"void",
"assertJsonNodeAbsent",
"(",
"Object",
"actual",
",",
"String",
"path",
")",
"{",
"if",
"(",
"!",
"nodeAbsent",
"(",
"actual",
",",
"path",
",",
"configuration",
")",
")",
"{",
"doFail",
"(",
"\"Node \\\"\"",
"+",
"path",
"+",
... | Fails if node in given path exists. | [
"Fails",
"if",
"node",
"in",
"given",
"path",
"exists",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L149-L153 |
115,679 | lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonNodePresent | public static void assertJsonNodePresent(Object actual, String path) {
if (nodeAbsent(actual, path, configuration)) {
doFail("Node \"" + path + "\" is missing.");
}
} | java | public static void assertJsonNodePresent(Object actual, String path) {
if (nodeAbsent(actual, path, configuration)) {
doFail("Node \"" + path + "\" is missing.");
}
} | [
"public",
"static",
"void",
"assertJsonNodePresent",
"(",
"Object",
"actual",
",",
"String",
"path",
")",
"{",
"if",
"(",
"nodeAbsent",
"(",
"actual",
",",
"path",
",",
"configuration",
")",
")",
"{",
"doFail",
"(",
"\"Node \\\"\"",
"+",
"path",
"+",
"\"\\... | Fails if node in given does not exist. | [
"Fails",
"if",
"node",
"in",
"given",
"does",
"not",
"exist",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L158-L162 |
115,680 | lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.when | public static Configuration when(Option first, Option... next) {
return Configuration.empty().withOptions(first, next);
} | java | public static Configuration when(Option first, Option... next) {
return Configuration.empty().withOptions(first, next);
} | [
"public",
"static",
"Configuration",
"when",
"(",
"Option",
"first",
",",
"Option",
"...",
"next",
")",
"{",
"return",
"Configuration",
".",
"empty",
"(",
")",
".",
"withOptions",
"(",
"first",
",",
"next",
")",
";",
"}"
] | Creates empty configuration and sets options. | [
"Creates",
"empty",
"configuration",
"and",
"sets",
"options",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L274-L276 |
115,681 | lukas-krecan/JsonUnit | json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java | JsonFluentAssert.isEqualTo | public JsonFluentAssert isEqualTo(Object expected) {
Diff diff = createDiff(expected, configuration);
diff.failIfDifferent(description);
return this;
} | java | public JsonFluentAssert isEqualTo(Object expected) {
Diff diff = createDiff(expected, configuration);
diff.failIfDifferent(description);
return this;
} | [
"public",
"JsonFluentAssert",
"isEqualTo",
"(",
"Object",
"expected",
")",
"{",
"Diff",
"diff",
"=",
"createDiff",
"(",
"expected",
",",
"configuration",
")",
";",
"diff",
".",
"failIfDifferent",
"(",
"description",
")",
";",
"return",
"this",
";",
"}"
] | Compares JSON for equality. The expected object is converted to JSON
before comparison. Ignores order of sibling nodes and whitespaces.
Please note that if you pass a String, it's parsed as JSON which can lead to an
unexpected behavior. If you pass in "1" it is parsed as a JSON containing
integer 1. If you compare it ... | [
"Compares",
"JSON",
"for",
"equality",
".",
"The",
"expected",
"object",
"is",
"converted",
"to",
"JSON",
"before",
"comparison",
".",
"Ignores",
"order",
"of",
"sibling",
"nodes",
"and",
"whitespaces",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java#L117-L121 |
115,682 | lukas-krecan/JsonUnit | json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java | JsonFluentAssert.hasSameStructureAs | @Deprecated
public JsonFluentAssert hasSameStructureAs(Object expected) {
Diff diff = createDiff(expected, configuration.withOptions(COMPARING_ONLY_STRUCTURE));
diff.failIfDifferent();
return this;
} | java | @Deprecated
public JsonFluentAssert hasSameStructureAs(Object expected) {
Diff diff = createDiff(expected, configuration.withOptions(COMPARING_ONLY_STRUCTURE));
diff.failIfDifferent();
return this;
} | [
"@",
"Deprecated",
"public",
"JsonFluentAssert",
"hasSameStructureAs",
"(",
"Object",
"expected",
")",
"{",
"Diff",
"diff",
"=",
"createDiff",
"(",
"expected",
",",
"configuration",
".",
"withOptions",
"(",
"COMPARING_ONLY_STRUCTURE",
")",
")",
";",
"diff",
".",
... | Compares JSON structure. Ignores values, only compares shape of the document and key names.
Is too lenient, ignores types, prefer IGNORING_VALUES option instead.
@param expected
@return {@code this} object.
@deprecated Use IGNORING_VALUES option instead | [
"Compares",
"JSON",
"structure",
".",
"Ignores",
"values",
"only",
"compares",
"shape",
"of",
"the",
"document",
"and",
"key",
"names",
".",
"Is",
"too",
"lenient",
"ignores",
"types",
"prefer",
"IGNORING_VALUES",
"option",
"instead",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java#L165-L170 |
115,683 | lukas-krecan/JsonUnit | json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java | JsonFluentAssert.node | public JsonFluentAssert node(String newPath) {
return new JsonFluentAssert(actual, path.copy(newPath), description, configuration);
} | java | public JsonFluentAssert node(String newPath) {
return new JsonFluentAssert(actual, path.copy(newPath), description, configuration);
} | [
"public",
"JsonFluentAssert",
"node",
"(",
"String",
"newPath",
")",
"{",
"return",
"new",
"JsonFluentAssert",
"(",
"actual",
",",
"path",
".",
"copy",
"(",
"newPath",
")",
",",
"description",
",",
"configuration",
")",
";",
"}"
] | Creates an assert object that only compares given node.
The path is denoted by JSON path, for example.
<code>
assertThatJson("{\"root\":{\"test\":[1,2,3]}}").node("root.test[0]").isEqualTo("1");
</code>
@param newPath
@return object comparing only node given by path. | [
"Creates",
"an",
"assert",
"object",
"that",
"only",
"compares",
"given",
"node",
".",
"The",
"path",
"is",
"denoted",
"by",
"JSON",
"path",
"for",
"example",
"."
] | 2b12ed792e8dd787bddd6f3b8eb2325737435791 | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java#L183-L185 |
115,684 | square/flow | flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleDispatcher.java | OrientationSampleDispatcher.requestLandscapeLock | boolean requestLandscapeLock() {
int requestedOrientation = activity.getRequestedOrientation();
if (requestedOrientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
// We're already locked.
return false;
}
activity.setRequestedOrientation(SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
// We've r... | java | boolean requestLandscapeLock() {
int requestedOrientation = activity.getRequestedOrientation();
if (requestedOrientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
// We're already locked.
return false;
}
activity.setRequestedOrientation(SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
// We've r... | [
"boolean",
"requestLandscapeLock",
"(",
")",
"{",
"int",
"requestedOrientation",
"=",
"activity",
".",
"getRequestedOrientation",
"(",
")",
";",
"if",
"(",
"requestedOrientation",
"==",
"SCREEN_ORIENTATION_SENSOR_LANDSCAPE",
")",
"{",
"// We're already locked.",
"return",... | Returns true if we've requested a lock and are expecting an orientation change
as a result. | [
"Returns",
"true",
"if",
"we",
"ve",
"requested",
"a",
"lock",
"and",
"are",
"expecting",
"an",
"orientation",
"change",
"as",
"a",
"result",
"."
] | 1656288d1cb4a92dfbcff8276f4d7f9e3390419b | https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleDispatcher.java#L91-L104 |
115,685 | square/flow | flow/src/main/java/flow/Flow.java | Flow.replaceHistory | public void replaceHistory(@NonNull final Object key, @NonNull final Direction direction) {
setHistory(getHistory().buildUpon().clear().push(key).build(), direction);
} | java | public void replaceHistory(@NonNull final Object key, @NonNull final Direction direction) {
setHistory(getHistory().buildUpon().clear().push(key).build(), direction);
} | [
"public",
"void",
"replaceHistory",
"(",
"@",
"NonNull",
"final",
"Object",
"key",
",",
"@",
"NonNull",
"final",
"Direction",
"direction",
")",
"{",
"setHistory",
"(",
"getHistory",
"(",
")",
".",
"buildUpon",
"(",
")",
".",
"clear",
"(",
")",
".",
"push... | Replaces the history with the given key and dispatches in the given direction. | [
"Replaces",
"the",
"history",
"with",
"the",
"given",
"key",
"and",
"dispatches",
"in",
"the",
"given",
"direction",
"."
] | 1656288d1cb4a92dfbcff8276f4d7f9e3390419b | https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/Flow.java#L208-L210 |
115,686 | square/flow | flow/src/main/java/flow/Flow.java | Flow.replaceTop | public void replaceTop(@NonNull final Object key, @NonNull final Direction direction) {
setHistory(getHistory().buildUpon().pop(1).push(key).build(), direction);
} | java | public void replaceTop(@NonNull final Object key, @NonNull final Direction direction) {
setHistory(getHistory().buildUpon().pop(1).push(key).build(), direction);
} | [
"public",
"void",
"replaceTop",
"(",
"@",
"NonNull",
"final",
"Object",
"key",
",",
"@",
"NonNull",
"final",
"Direction",
"direction",
")",
"{",
"setHistory",
"(",
"getHistory",
"(",
")",
".",
"buildUpon",
"(",
")",
".",
"pop",
"(",
"1",
")",
".",
"pus... | Replaces the top key of the history with the given key and dispatches in the given direction. | [
"Replaces",
"the",
"top",
"key",
"of",
"the",
"history",
"with",
"the",
"given",
"key",
"and",
"dispatches",
"in",
"the",
"given",
"direction",
"."
] | 1656288d1cb4a92dfbcff8276f4d7f9e3390419b | https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/Flow.java#L215-L217 |
115,687 | square/flow | flow/src/main/java/flow/History.java | History.peek | @NonNull public <T> T peek(int index) {
//noinspection unchecked
return (T) history.get(history.size() - index - 1);
} | java | @NonNull public <T> T peek(int index) {
//noinspection unchecked
return (T) history.get(history.size() - index - 1);
} | [
"@",
"NonNull",
"public",
"<",
"T",
">",
"T",
"peek",
"(",
"int",
"index",
")",
"{",
"//noinspection unchecked",
"return",
"(",
"T",
")",
"history",
".",
"get",
"(",
"history",
".",
"size",
"(",
")",
"-",
"index",
"-",
"1",
")",
";",
"}"
] | Returns the app state at the provided index in history. 0 is the newest entry. | [
"Returns",
"the",
"app",
"state",
"at",
"the",
"provided",
"index",
"in",
"history",
".",
"0",
"is",
"the",
"newest",
"entry",
"."
] | 1656288d1cb4a92dfbcff8276f4d7f9e3390419b | https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/History.java#L93-L96 |
115,688 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.addListeners | protected void addListeners() {
Editable text = getText();
if (text != null) {
text.setSpan(spanWatcher, 0, text.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
addTextChangedListener(textWatcher);
}
} | java | protected void addListeners() {
Editable text = getText();
if (text != null) {
text.setSpan(spanWatcher, 0, text.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
addTextChangedListener(textWatcher);
}
} | [
"protected",
"void",
"addListeners",
"(",
")",
"{",
"Editable",
"text",
"=",
"getText",
"(",
")",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"text",
".",
"setSpan",
"(",
"spanWatcher",
",",
"0",
",",
"text",
".",
"length",
"(",
")",
",",
"Span... | Add the TextChangedListeners | [
"Add",
"the",
"TextChangedListeners"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L109-L115 |
115,689 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.removeListeners | protected void removeListeners() {
Editable text = getText();
if (text != null) {
TokenSpanWatcher[] spanWatchers = text.getSpans(0, text.length(), TokenSpanWatcher.class);
for (TokenSpanWatcher watcher : spanWatchers) {
text.removeSpan(watcher);
}
... | java | protected void removeListeners() {
Editable text = getText();
if (text != null) {
TokenSpanWatcher[] spanWatchers = text.getSpans(0, text.length(), TokenSpanWatcher.class);
for (TokenSpanWatcher watcher : spanWatchers) {
text.removeSpan(watcher);
}
... | [
"protected",
"void",
"removeListeners",
"(",
")",
"{",
"Editable",
"text",
"=",
"getText",
"(",
")",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"TokenSpanWatcher",
"[",
"]",
"spanWatchers",
"=",
"text",
".",
"getSpans",
"(",
"0",
",",
"text",
".",... | Remove the TextChangedListeners | [
"Remove",
"the",
"TextChangedListeners"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L120-L129 |
115,690 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.init | private void init() {
if (initialized) return;
// Initialise variables
setTokenizer(new CharacterTokenizer(Arrays.asList(',', ';'), ","));
Editable text = getText();
assert null != text;
spanWatcher = new TokenSpanWatcher();
textWatcher = new TokenTextWatcher();
... | java | private void init() {
if (initialized) return;
// Initialise variables
setTokenizer(new CharacterTokenizer(Arrays.asList(',', ';'), ","));
Editable text = getText();
assert null != text;
spanWatcher = new TokenSpanWatcher();
textWatcher = new TokenTextWatcher();
... | [
"private",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"initialized",
")",
"return",
";",
"// Initialise variables",
"setTokenizer",
"(",
"new",
"CharacterTokenizer",
"(",
"Arrays",
".",
"asList",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"\",\"",
")",
")",
... | Initialise the variables and various listeners | [
"Initialise",
"the",
"variables",
"and",
"various",
"listeners"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L134-L206 |
115,691 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.getObjects | public List<T> getObjects() {
ArrayList<T>objects = new ArrayList<>();
Editable text = getText();
if (hiddenContent != null) {
text = hiddenContent;
}
for (TokenImageSpan span: text.getSpans(0, text.length(), TokenImageSpan.class)) {
objects.add(span.getTo... | java | public List<T> getObjects() {
ArrayList<T>objects = new ArrayList<>();
Editable text = getText();
if (hiddenContent != null) {
text = hiddenContent;
}
for (TokenImageSpan span: text.getSpans(0, text.length(), TokenImageSpan.class)) {
objects.add(span.getTo... | [
"public",
"List",
"<",
"T",
">",
"getObjects",
"(",
")",
"{",
"ArrayList",
"<",
"T",
">",
"objects",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Editable",
"text",
"=",
"getText",
"(",
")",
";",
"if",
"(",
"hiddenContent",
"!=",
"null",
")",
"{"... | Get the list of Tokens
@return List of tokens | [
"Get",
"the",
"list",
"of",
"Tokens"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L323-L333 |
115,692 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.getTextForAccessibility | @SuppressWarnings("unused")
public CharSequence getTextForAccessibility() {
if (getObjects().size() == 0) {
return getText();
}
SpannableStringBuilder description = new SpannableStringBuilder();
Editable text = getText();
int selectionStart = -1;
int sele... | java | @SuppressWarnings("unused")
public CharSequence getTextForAccessibility() {
if (getObjects().size() == 0) {
return getText();
}
SpannableStringBuilder description = new SpannableStringBuilder();
Editable text = getText();
int selectionStart = -1;
int sele... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"CharSequence",
"getTextForAccessibility",
"(",
")",
"{",
"if",
"(",
"getObjects",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"getText",
"(",
")",
";",
"}",
"SpannableStringBui... | Correctly build accessibility string for token contents
This seems to be a hidden API, but there doesn't seem to be another reasonable way
@return custom string for accessibility | [
"Correctly",
"build",
"accessibility",
"string",
"for",
"token",
"contents"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L412-L463 |
115,693 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.clearCompletionText | @SuppressWarnings("unused")
public void clearCompletionText() {
//Respect currentCompletionText in case hint is visible or if other checks are added.
if (currentCompletionText().length() == 0){
return;
}
Range currentRange = getCurrentCandidateTokenRange();
inter... | java | @SuppressWarnings("unused")
public void clearCompletionText() {
//Respect currentCompletionText in case hint is visible or if other checks are added.
if (currentCompletionText().length() == 0){
return;
}
Range currentRange = getCurrentCandidateTokenRange();
inter... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"clearCompletionText",
"(",
")",
"{",
"//Respect currentCompletionText in case hint is visible or if other checks are added.",
"if",
"(",
"currentCompletionText",
"(",
")",
".",
"length",
"(",
")",
"==",
"... | Clear the completion text only. | [
"Clear",
"the",
"completion",
"text",
"only",
"."
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L468-L479 |
115,694 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.handleDone | private void handleDone() {
// Attempt to complete the current token token
performCompletion();
// Hide the keyboard
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hid... | java | private void handleDone() {
// Attempt to complete the current token token
performCompletion();
// Hide the keyboard
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hid... | [
"private",
"void",
"handleDone",
"(",
")",
"{",
"// Attempt to complete the current token token",
"performCompletion",
"(",
")",
";",
"// Hide the keyboard",
"InputMethodManager",
"imm",
"=",
"(",
"InputMethodManager",
")",
"getContext",
"(",
")",
".",
"getSystemService",... | Create a token and hide the keyboard when the user sends the DONE IME action
Use IME_NEXT if you want to create a token and go to the next field | [
"Create",
"a",
"token",
"and",
"hide",
"the",
"keyboard",
"when",
"the",
"user",
"sends",
"the",
"DONE",
"IME",
"action",
"Use",
"IME_NEXT",
"if",
"you",
"want",
"to",
"create",
"a",
"token",
"and",
"go",
"to",
"the",
"next",
"field"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L627-L637 |
115,695 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.performCollapse | public void performCollapse(boolean hasFocus) {
internalEditInProgress = true;
if (!hasFocus) {
// Display +x thingy/ellipse if appropriate
final Editable text = getText();
if (text != null && hiddenContent == null && lastLayout != null) {
//Ellipsize... | java | public void performCollapse(boolean hasFocus) {
internalEditInProgress = true;
if (!hasFocus) {
// Display +x thingy/ellipse if appropriate
final Editable text = getText();
if (text != null && hiddenContent == null && lastLayout != null) {
//Ellipsize... | [
"public",
"void",
"performCollapse",
"(",
"boolean",
"hasFocus",
")",
"{",
"internalEditInProgress",
"=",
"true",
";",
"if",
"(",
"!",
"hasFocus",
")",
"{",
"// Display +x thingy/ellipse if appropriate",
"final",
"Editable",
"text",
"=",
"getText",
"(",
")",
";",
... | Collapse the view by removing all the tokens not on the first line. Displays a "+x" token.
Restores the hidden tokens when the view gains focus.
@param hasFocus boolean indicating whether we have the focus or not. | [
"Collapse",
"the",
"view",
"by",
"removing",
"all",
"the",
"tokens",
"not",
"on",
"the",
"first",
"line",
".",
"Displays",
"a",
"+",
"x",
"token",
".",
"Restores",
"the",
"hidden",
"tokens",
"when",
"the",
"view",
"gains",
"focus",
"."
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L782-L834 |
115,696 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.addObjectSync | @UiThread
public void addObjectSync(T object) {
if (object == null) return;
if (shouldIgnoreToken(object)) {
if (listener != null) {
listener.onTokenIgnored(object);
}
return;
}
if (tokenLimit != -1 && getObjects().size() == tokenLi... | java | @UiThread
public void addObjectSync(T object) {
if (object == null) return;
if (shouldIgnoreToken(object)) {
if (listener != null) {
listener.onTokenIgnored(object);
}
return;
}
if (tokenLimit != -1 && getObjects().size() == tokenLi... | [
"@",
"UiThread",
"public",
"void",
"addObjectSync",
"(",
"T",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"return",
";",
"if",
"(",
"shouldIgnoreToken",
"(",
"object",
")",
")",
"{",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"lis... | Append a token object to the object list. May only be called from the main thread.
@param object the object to add to the displayed tokens | [
"Append",
"a",
"token",
"object",
"to",
"the",
"object",
"list",
".",
"May",
"only",
"be",
"called",
"from",
"the",
"main",
"thread",
"."
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L915-L927 |
115,697 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.clearAsync | public void clearAsync() {
post(new Runnable() {
@Override
public void run() {
for (T object: getObjects()) {
removeObjectSync(object);
}
}
});
} | java | public void clearAsync() {
post(new Runnable() {
@Override
public void run() {
for (T object: getObjects()) {
removeObjectSync(object);
}
}
});
} | [
"public",
"void",
"clearAsync",
"(",
")",
"{",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"for",
"(",
"T",
"object",
":",
"getObjects",
"(",
")",
")",
"{",
"removeObjectSync",
"(",
"object"... | Remove all objects from the token list. Objects will be removed on the main thread. | [
"Remove",
"all",
"objects",
"from",
"the",
"token",
"list",
".",
"Objects",
"will",
"be",
"removed",
"on",
"the",
"main",
"thread",
"."
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L995-L1004 |
115,698 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.updateCountSpan | private void updateCountSpan() {
//No count span with free form text
if (!preventFreeFormText) { return; }
Editable text = getText();
int visibleCount = getText().getSpans(0, getText().length(), TokenImageSpan.class).length;
countSpan.setCount(getObjects().size() - visibleCount... | java | private void updateCountSpan() {
//No count span with free form text
if (!preventFreeFormText) { return; }
Editable text = getText();
int visibleCount = getText().getSpans(0, getText().length(), TokenImageSpan.class).length;
countSpan.setCount(getObjects().size() - visibleCount... | [
"private",
"void",
"updateCountSpan",
"(",
")",
"{",
"//No count span with free form text",
"if",
"(",
"!",
"preventFreeFormText",
")",
"{",
"return",
";",
"}",
"Editable",
"text",
"=",
"getText",
"(",
")",
";",
"int",
"visibleCount",
"=",
"getText",
"(",
")",... | Set the count span the current number of hidden objects | [
"Set",
"the",
"count",
"span",
"the",
"current",
"number",
"of",
"hidden",
"objects"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L1009-L1032 |
115,699 | splitwise/TokenAutoComplete | library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java | TokenCompleteTextView.removeSpan | private void removeSpan(Editable text, TokenImageSpan span) {
//We usually add whitespace after a token, so let's try to remove it as well if it's present
int end = text.getSpanEnd(span);
if (end < text.length() && text.charAt(end) == ' ') {
end += 1;
}
internalEditI... | java | private void removeSpan(Editable text, TokenImageSpan span) {
//We usually add whitespace after a token, so let's try to remove it as well if it's present
int end = text.getSpanEnd(span);
if (end < text.length() && text.charAt(end) == ' ') {
end += 1;
}
internalEditI... | [
"private",
"void",
"removeSpan",
"(",
"Editable",
"text",
",",
"TokenImageSpan",
"span",
")",
"{",
"//We usually add whitespace after a token, so let's try to remove it as well if it's present",
"int",
"end",
"=",
"text",
".",
"getSpanEnd",
"(",
"span",
")",
";",
"if",
... | Remove a span from the current EditText and fire the appropriate callback
@param text Editable to remove the span from
@param span TokenImageSpan to be removed | [
"Remove",
"a",
"span",
"from",
"the",
"current",
"EditText",
"and",
"fire",
"the",
"appropriate",
"callback"
] | 3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5 | https://github.com/splitwise/TokenAutoComplete/blob/3f92f90c4c42efc7129d91cbc3d3ec2d1a7bfac5/library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java#L1040-L1054 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.