Skip to content

Commit

Permalink
toString() now returns the content type
Browse files Browse the repository at this point in the history
  • Loading branch information
ao-apps committed Mar 9, 2021
1 parent f0bb86e commit 6a041d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ along with ao-encoding. If not, see <http://www.gnu.org/licenses />.
shortTitle="Changelog"
tocLevels="1"
datePublished="2016-10-29T20:03:30-0500"
dateModified="2021-03-08T16:23:19-06:00"
dateModified="2021-03-08T22:44:48-06:00"
>
<c:if test="${fn:endsWith('@{project.version}', '-SNAPSHOT') and !fn:endsWith('@{project.version}', '-POST-SNAPSHOT')}">
<changelog:release
Expand Down Expand Up @@ -66,6 +66,7 @@ along with ao-encoding. If not, see <http://www.gnu.org/licenses />.
<code>TextWriter.text(Object)</code> now supports <code>Writable</code> that <code>isFastToString()</code>,
which allows for both optimizations and access to characters for automatic newline and indentation.
</li>
<li><code>MediaType.toString()</code> now returns the content type.</li>
</ul>
<!-- TODO:
<ul>
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/com/aoindustries/encoding/MediaType.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ao-encoding - High performance streaming character encoding.
* Copyright (C) 2009, 2010, 2011, 2013, 2015, 2016, 2018, 2019, 2020 AO Industries, Inc.
* Copyright (C) 2009, 2010, 2011, 2013, 2015, 2016, 2018, 2019, 2020, 2021 AO Industries, Inc.
* [email protected]
* 7262 Bull Pen Cir
* Mobile, AL 36695
Expand Down Expand Up @@ -33,7 +33,6 @@
*
* @author AO Industries, Inc.
*/
// TODO: Add toString method of the contentType
public enum MediaType {

/**
Expand Down Expand Up @@ -216,6 +215,15 @@ private MediaType(String contentType) {
this.contentType = contentType;
}

/**
* Delegates to {@link #getContentType()}.
*/
@Override
public String toString() {
return getContentType();
}


abstract boolean isUsedFor(String contentType);

/**
Expand Down

0 comments on commit 6a041d2

Please sign in to comment.