Compare commits

...

4 Commits

Author SHA1 Message Date
Naohide Sano
06cebec024
Create codeql-analysis.yml 2020-10-03 15:04:13 +09:00
Naohide Sano
a2111c7d49
Update README.md 2020-04-30 18:09:43 +09:00
umjammer
9f21bf5d1d prepare for unit tests 2019-07-08 23:26:33 +09:00
umjammer
5a9ac804a2 add jitpack badge 2019-06-09 10:00:20 +09:00
10 changed files with 257 additions and 61 deletions

71
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
# schedule:
# - cron: '0 9 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['java']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,3 +1,5 @@
[![](https://jitpack.io/v/umjammer/jbinhex.svg)](https://jitpack.io/#umjammer/jbinhex) [![Parent](https://img.shields.io/badge/Parent-vavi--util--archive-pink)](https://github.com/umjammer/vavi-util-archive)
# JBinHex
JBinHex is both a library and a command-line tool to decode files in

14
pom.xml
View File

@ -32,4 +32,18 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -449,27 +449,6 @@ public class BinHex4InputStream extends InputStream {
return (fl1 << 8) | fl2;
}
public static void main(String[] args)
{
try (BinHex4InputStream in = new BinHex4InputStream(System.in)) {
System.err.println(in.getHeader());
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while(true)
{
int r = in.read(buf);
if(r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch(IOException e)
{
e.printStackTrace();
}
}
/**
One of three states: before header, in data fork, or in resource fork.
*/

View File

@ -298,26 +298,6 @@ public class Hqx7_to_Hqx8InputStream extends FilterInputStream {
return len;
}
public static void main(String[] args)
{
try (InputStream in = new Hqx7_to_Hqx8InputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while(true)
{
int r = in.read(buf);
if(r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch(IOException e)
{
e.printStackTrace();
}
}
/**
A buffer for a maximum of two times six bits.
*/

View File

@ -254,26 +254,6 @@ public class RLE_CRCInputStream extends FilterInputStream {
return len;
}
public static void main(String[] args)
{
try (InputStream in = new RLE_CRCInputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while(true)
{
int r = in.read(buf);
if(r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch(IOException e)
{
e.printStackTrace();
}
}
/**
True if private method nextDecodedByte is still repeating a character
that was part of a Run-Length Encoding sequence.

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* BinHex4InputStreamTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class BinHex4InputStreamTest {
@Test
void test() {
fail("Not yet implemented");
}
public static void main(String[] args) {
try (BinHex4InputStream in = new BinHex4InputStream(System.in)) {
System.err.println(in.getHeader());
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while (true) {
int r = in.read(buf);
if (r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* */

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* DeBinHexTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class DeBinHexTest {
@Test
void test() {
fail("Not yet implemented");
}
}
/* */

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* Hqx7_to_Hqx8InputStreamTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class Hqx7_to_Hqx8InputStreamTest {
@Test
void test() {
fail("Not yet implemented");
}
public static void main(String[] args) {
try (InputStream in = new Hqx7_to_Hqx8InputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while (true) {
int r = in.read(buf);
if (r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* */

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package org.gjt.convert.binhex;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* RLE_CRCInputStreamTest.
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (umjammer)
* @version 0.00 2019/06/11 umjammer initial version <br>
*/
class RLE_CRCInputStreamTest {
@Test
void test() {
fail("Not yet implemented");
}
public static void main(String[] args) {
try (InputStream in = new RLE_CRCInputStream(System.in)) {
byte[] buf = new byte[1024];
System.err.println("Starting to convert");
while (true) {
int r = in.read(buf);
if (r <= 0)
return;
System.out.write(buf, 0, r);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* */